olaf@0: /* olaf@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. olaf@0: * olaf@0: * Copyright 2011 Olaf Wintermann. All rights reserved. olaf@0: * olaf@0: * Redistribution and use in source and binary forms, with or without olaf@0: * modification, are permitted provided that the following conditions are met: olaf@0: * olaf@0: * 1. Redistributions of source code must retain the above copyright olaf@0: * notice, this list of conditions and the following disclaimer. olaf@0: * olaf@0: * 2. Redistributions in binary form must reproduce the above copyright olaf@0: * notice, this list of conditions and the following disclaimer in the olaf@0: * documentation and/or other materials provided with the distribution. olaf@0: * olaf@0: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" olaf@0: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE olaf@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE olaf@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE olaf@0: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR olaf@0: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF olaf@0: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS olaf@0: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN olaf@0: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) olaf@0: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE olaf@0: * POSSIBILITY OF SUCH DAMAGE. olaf@0: */ olaf@0: olaf@0: #include olaf@0: #include olaf@0: universe@26: #include "ucx/test.h" universe@26: olaf@9: #include "list_tests.h" olaf@13: #include "mpool_tests.h" olaf@20: #include "map_tests.h" olaf@9: universe@26: UCX_TEST_BEGIN(testTestSuitePositive) { universe@26: UCX_TEST_ASSERT(2*2 == 4, "the test framework fails") universe@26: UCX_TEST_END universe@26: } universe@26: universe@26: UCX_TEST_BEGIN(testTestSuiteNegative) { universe@26: UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works") universe@26: UCX_TEST_END universe@26: } universe@26: olaf@0: int main(int argc, char **argv) { olaf@13: printf("UCX Tests\n---------\n"); olaf@9: universe@26: printf("\nUcxTestSuite Tests\n"); universe@26: UcxTestSuite* suite = ucx_test_suite_new(); universe@26: ucx_test_register(suite, testTestSuitePositive); universe@26: ucx_test_register(suite, testTestSuiteNegative); universe@26: ucx_test_run(suite, stdout); universe@26: if (suite->failure == 1 && suite->success == 1) { universe@26: ucx_test_suite_free(suite); universe@26: universe@26: /* TODO: replace these tests with "real" tests */ universe@26: printf("\nUcxDlist Tests\n"); universe@26: if(dlist_tests()) { universe@26: fprintf(stderr, "dlist_tests failed\n"); universe@26: } universe@26: universe@26: printf("\nUcxList Tests\n Assumed to be correct\n"); universe@26: universe@26: printf("\nUcxMemPool Tests\n"); universe@26: if(mpool_tests()) { universe@26: fprintf(stderr, "mpool_tests failed\n"); universe@26: } universe@26: universe@26: printf("\nUcxMap Tests\n"); universe@26: if(map_tests()) { universe@26: fprintf(stderr, "map_tests failed\n"); universe@26: } universe@26: universe@26: return EXIT_SUCCESS; universe@26: } else { universe@26: ucx_test_suite_free(suite); universe@26: return EXIT_FAILURE; olaf@13: } olaf@0: } olaf@0: