# HG changeset patch # User Mike Becker # Date 1508346629 -7200 # Node ID c45c385ac578c3a99172bfa466dc1f221a370fe6 # Parent e19825a1430a1c3effe77becc49038fdc222f44b fixes include path and non-cpp build for test program diff -r e19825a1430a -r c45c385ac578 test/Makefile.am --- a/test/Makefile.am Wed Oct 18 14:23:57 2017 +0200 +++ b/test/Makefile.am Wed Oct 18 19:10:29 2017 +0200 @@ -1,5 +1,6 @@ TESTS = ucxtest check_PROGRAMS = ucxtest +ucxtest_CFLAGS = -I$(top_srcdir)/src ucxtest_SOURCES = main.c ucxtest_SOURCES += allocator_tests.c ucxtest_SOURCES += list_tests.c @@ -13,4 +14,3 @@ ucxtest_SOURCES += buffer_tests.c ucxtest_SOURCES += utils_tests.c ucxtest_LDADD = ../src/libucx.la - diff -r e19825a1430a -r c45c385ac578 test/main.c --- a/test/main.c Wed Oct 18 14:23:57 2017 +0200 +++ b/test/main.c Wed Oct 18 19:10:29 2017 +0200 @@ -45,61 +45,65 @@ #include "utils_tests.h" #include "avl_tests.h" +#ifdef __cplusplus extern "C" { - UCX_TEST(testTestSuitePositive) { - UCX_TEST_BEGIN - UCX_TEST_ASSERT(2*2 == 4, "the test framework fails"); - UCX_TEST_END - } +#endif +UCX_TEST(testTestSuitePositive) { + UCX_TEST_BEGIN + UCX_TEST_ASSERT(2*2 == 4, "the test framework fails"); + UCX_TEST_END +} - UCX_TEST(testTestSuiteNegative) { - UCX_TEST_BEGIN - UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works"); - UCX_TEST_END - } +UCX_TEST(testTestSuiteNegative) { + UCX_TEST_BEGIN + UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works"); + UCX_TEST_END +} - UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) { - UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails"); - } +UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) { + UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails"); +} - UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) { - UCX_TEST_ASSERT(i == 42, "two parameter routine fails"); - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f); - } +UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) { + UCX_TEST_ASSERT(i == 42, "two parameter routine fails"); + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f); +} - UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) { - *i += 2; - UCX_TEST_ASSERT(*i==4, "the test framework fails"); - } +UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) { + *i += 2; + UCX_TEST_ASSERT(*i==4, "the test framework fails"); +} - UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) { - *i += 2; - // Next test shall fail! - UCX_TEST_ASSERT(*i==4, "the test framework works"); - } +UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) { + *i += 2; + // Next test shall fail! + UCX_TEST_ASSERT(*i==4, "the test framework works"); +} - UCX_TEST(testTestSuiteRoutinePositive) { - int i = 2; - UCX_TEST_BEGIN - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i); - UCX_TEST_ASSERT(i==4, "the test framework fails"); - UCX_TEST_END - } +UCX_TEST(testTestSuiteRoutinePositive) { + int i = 2; + UCX_TEST_BEGIN + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i); + UCX_TEST_ASSERT(i==4, "the test framework fails"); + UCX_TEST_END +} - UCX_TEST(testTestSuiteRoutineNegative) { - int i = 0; - UCX_TEST_BEGIN - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i); - UCX_TEST_ASSERT(1, "the test framework fails"); - UCX_TEST_END - } +UCX_TEST(testTestSuiteRoutineNegative) { + int i = 0; + UCX_TEST_BEGIN + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i); + UCX_TEST_ASSERT(1, "the test framework fails"); + UCX_TEST_END +} - UCX_TEST(testTestSuiteRoutineMultiparam) { - UCX_TEST_BEGIN - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f); - UCX_TEST_END - } +UCX_TEST(testTestSuiteRoutineMultiparam) { + UCX_TEST_BEGIN + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f); + UCX_TEST_END } +#ifdef __cplusplus +} +#endif int main(int argc, char **argv) { printf("UCX Tests\n---------\n");