Files @ c718c481771c
Branch filter:

Location: DistRen/test/check.c

binki
Fix up testsuite to actually run tests and to use one executable instead of three.
/*
 * Copyright 2010 Nathan Phillip Brink
 *
 * This file is a part of DistRen.
 *
 * DistRen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DistRen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with DistRen.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <check.h>
#include <stdio.h>
#include <stdlib.h>

#include "check_asprintf.h"
#include "check_csv.h"
#include "check_execio.h"

/**
 * \brief
 *   Use libcheck to run our full testsuite.
 */
int main(int argc, char *argv[])
{
  int number_failed;
  size_t test_num;

  Suite *s;
  SRunner *sr;

  Suite *(*suites[])() =
    {
      &asprintf_suite,
      &csv_suite,
      &execio_suite,
      NULL
    };

  number_failed = 0;

  for (test_num = 0; suites[test_num]; test_num ++)
    {
      s = (*suites[test_num])();
      sr = srunner_create(s);

      srunner_run_all(sr, CK_NORMAL);
      number_failed += srunner_ntests_failed(sr);
      srunner_free(sr);
    }

  if (number_failed)
    {
      fprintf(stderr, "total tests failed: %d\n", number_failed);
      return EXIT_FAILURE;
    }
  return EXIT_SUCCESS;
}