/* Siconos is a program dedicated to modeling, simulation and control
 * of non smooth dynamical systems.
 *
 * Copyright 2021 INRIA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#define _XOPEN_SOURCE 700
#include <stdio.h>                         // for printf
#include <string.h>                        // for strcmp
#include "genericMechanical_test_utils.h"  // for build_test_collection, gmp...
#include "test_utils.h"                    // for data_collection, free_test...
#include "SiconosConfig.h" // for HAVE_GAMS_C_API // IWYU pragma: keep

#define @PROBLEM_COLLECTION@ 1

#ifdef SICONOS_HAS_MPI
#include "mpi.h"
#endif

int main (int argc, char *argv[])
{
#ifdef SICONOS_HAS_MPI
  MPI_Init(&argc, &argv);
#endif
  
  const char ** _data_collection = data_collection();
  int n_data = 0;
  
  while (strcmp(_data_collection[n_data], "---") !=0)
    {
      n_data++;
    }
  printf("number of data = %i\n", n_data);
  
  int number_of_tests;
  TestCase * collection = build_test_collection(n_data, _data_collection, &number_of_tests);
  printf("%i tests for %i data files.\n", number_of_tests, n_data);
  int out = run_test_collection(collection, number_of_tests, gmp_test_function);
  free_test_collection(collection, number_of_tests);
  
#ifdef SICONOS_HAS_MPI
  MPI_Finalize();
#endif
  
  return out;
}
  
