#define CHAZ_USE_SHORT_NAMES #include #include #include "Charmonizer/Test/AllTests.h" static TestBatch **batches = NULL; void chaz_AllTests_init() { chaz_Test_init(); /* create a null-terminated array of test batches to iterate over */ batches = malloc(7 * sizeof(TestBatch*)); batches[0] = chaz_TFuncMacro_prepare(); batches[1] = chaz_THeaders_prepare(); batches[2] = chaz_TIntegers_prepare(); batches[3] = chaz_TLargeFiles_prepare(); batches[4] = chaz_TUnusedVars_prepare(); batches[5] = chaz_TVariadicMacros_prepare(); batches[6] = NULL; } void chaz_AllTests_run() { int total_tests = 0; int total_passed = 0; int total_failed = 0; int total_skipped = 0; int i; /* sanity check */ if (batches == NULL) { fprintf(stderr, "Must call AllTests_init() first."); exit(1); } /* loop through test functions, accumulating results */ for (i = 0; batches[i] != NULL; i++) { chaz_TestBatch *batch = batches[i]; batch->run_test(batch); total_tests += batch->num_tests; total_passed += batch->num_passed; total_failed += batch->num_failed; total_skipped += batch->num_skipped; batch->destroy(batch); } /* print totals */ printf("=============================\n"); printf("TOTAL TESTS: %d\nTOTAL PASSED: %d\nTOTAL FAILED: %d\n" "TOTAL SKIPPED: %d\n", total_tests, total_passed, total_failed, total_skipped); } /** * Copyright 2006 The Apache Software Foundation * * 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. */