From cafc66e09f2b6af6cf6c285b713911962ddcbb81 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Tue, 24 Oct 2023 00:58:38 -0400 Subject: [PATCH] Make unit tests use the testing lib main function. --- AutoRAII.test/0.cc | 6 ------ Exception.test/exception.cc | 9 --------- Meta/Meta.test/traits.cc | 6 ------ Mockination/MockMutex.test/test0.cc | 6 ------ Mockination/MockMutex.test/test1.cc | 6 ------ Proof/Attestation.test/test.cc | 11 +++++++---- Reflection/tuplizeAggregate.test/0.cc | 6 ------ Testing/TableTest.test/test.cc | 9 --------- Testing/TableTest.test/test2.cc | 7 ------- Thread.test/thread.cc | 9 --------- Truss/memory.test/examples.cc | 5 ----- cmake/rules.cmake | 1 + comparisons.test/0.cc | 9 --------- dumbhash.test/0.cc | 6 ------ 14 files changed, 8 insertions(+), 88 deletions(-) diff --git a/AutoRAII.test/0.cc b/AutoRAII.test/0.cc index 133ec4e..0abaf92 100644 --- a/AutoRAII.test/0.cc +++ b/AutoRAII.test/0.cc @@ -5,12 +5,6 @@ static_assert( __cplusplus > 2020'00 ); #include #include -int -main( const int argcnt, const char *const argvec[] ) -{ - return Alepha::Testing::runAllTests( argcnt, argvec ); -} - static auto tests= Alepha::Utility::enroll <=[] { using namespace Alepha::Hydrogen::exports::auto_raii; diff --git a/Exception.test/exception.cc b/Exception.test/exception.cc index 9655cb8..a9fc834 100644 --- a/Exception.test/exception.cc +++ b/Exception.test/exception.cc @@ -12,16 +12,7 @@ namespace { using Alepha::Hydrogen::exports::types::argcnt_t; using Alepha::Hydrogen::exports::types::argvec_t; -} -int -main( const argcnt_t argcnt, const argvec_t argvec ) -{ - return Alepha::Testing::runAllTests( argcnt, argvec ); -} - -namespace -{ namespace util= Alepha::Utility; using namespace Alepha::Testing::exports; namespace boost= Alepha::boost; diff --git a/Meta/Meta.test/traits.cc b/Meta/Meta.test/traits.cc index 1f1a919..cfc687a 100644 --- a/Meta/Meta.test/traits.cc +++ b/Meta/Meta.test/traits.cc @@ -11,12 +11,6 @@ static_assert( __cplusplus > 2020'00 ); #include -int -main( const int argcnt, const char *const *const argvec ) -{ - return Alepha::Testing::runAllTests( argcnt, argvec ); -} - namespace { using namespace Alepha::Utility::exports::evaluation_helpers; diff --git a/Mockination/MockMutex.test/test0.cc b/Mockination/MockMutex.test/test0.cc index 9e2cf17..b1afc90 100644 --- a/Mockination/MockMutex.test/test0.cc +++ b/Mockination/MockMutex.test/test0.cc @@ -156,9 +156,3 @@ namespace assert( mtx.getWaiters().size() == 0 ); }; } - -int -main( const int argcnt, const char *const *const argvec ) -{ - return runAllTests( { argvec + 1, argvec + argcnt } ); -} diff --git a/Mockination/MockMutex.test/test1.cc b/Mockination/MockMutex.test/test1.cc index 6ca05ac..927b479 100644 --- a/Mockination/MockMutex.test/test1.cc +++ b/Mockination/MockMutex.test/test1.cc @@ -92,9 +92,3 @@ namespace thread2.join(); }; } - -int -main( const int argcnt, const char *const *const argvec ) -{ - return runAllTests( { argvec + 1, argvec + argcnt } ); -} diff --git a/Proof/Attestation.test/test.cc b/Proof/Attestation.test/test.cc index 6ab951a..05e3b24 100644 --- a/Proof/Attestation.test/test.cc +++ b/Proof/Attestation.test/test.cc @@ -1,5 +1,7 @@ #include "../Attestation.h" +#include + #include #include #include @@ -11,8 +13,11 @@ #include + namespace { + using namespace Alepha::Testing::literals::test_literals; + struct Tester; struct foobar_tag { using averant= Tester; }; @@ -145,8 +150,7 @@ namespace } -int -main() +auto simpleTest= "Simple attestation test"_test <=[] { Tester::test(); //attest( FoobarFact::permission ); @@ -182,8 +186,7 @@ main() checker( lk ); auto myInt= makeUnique< int >(); - return EXIT_SUCCESS; -} +}; diff --git a/Reflection/tuplizeAggregate.test/0.cc b/Reflection/tuplizeAggregate.test/0.cc index 3bfedeb..b441772 100644 --- a/Reflection/tuplizeAggregate.test/0.cc +++ b/Reflection/tuplizeAggregate.test/0.cc @@ -8,12 +8,6 @@ static_assert( __cplusplus > 2020'00 ); using Alepha::argcnt_t, Alepha::argvec_t; -int -main( const argcnt_t argcnt, const argvec_t argvec ) -{ - return Alepha::Testing::runAllTests( argcnt, argvec ); -} - namespace { using namespace Alepha::Testing::literals; diff --git a/Testing/TableTest.test/test.cc b/Testing/TableTest.test/test.cc index 3395444..306f94e 100644 --- a/Testing/TableTest.test/test.cc +++ b/Testing/TableTest.test/test.cc @@ -7,16 +7,7 @@ static_assert( __cplusplus > 2020'00 ); namespace { namespace UnitTest= Alepha::Testing::exports; -} -int -main( const int argcnt, const char *const *const argvec ) -{ - return UnitTest::runAllTests( argcnt, argvec ); -} - -namespace -{ using namespace Alepha::Utility::exports::evaluation_helpers; using namespace UnitTest::literals; using UnitTest::TableTest; diff --git a/Testing/TableTest.test/test2.cc b/Testing/TableTest.test/test2.cc index ff3972a..7b412ea 100644 --- a/Testing/TableTest.test/test2.cc +++ b/Testing/TableTest.test/test2.cc @@ -5,13 +5,6 @@ static_assert( __cplusplus > 2020'00 ); #include -int -main( const int argcnt, const char *const *const argvec ) -{ - return Alepha::Testing::runAllTests( argcnt, argvec ); -} - - namespace { using namespace Alepha::Testing::exports; diff --git a/Thread.test/thread.cc b/Thread.test/thread.cc index 4449096..0bb9eb4 100644 --- a/Thread.test/thread.cc +++ b/Thread.test/thread.cc @@ -12,16 +12,7 @@ namespace { using Alepha::exports::types::argcnt_t; using Alepha::exports::types::argvec_t; -} -int -main( const argcnt_t argcnt, const argvec_t argvec ) -{ - return Alepha::Testing::runAllTests( argcnt, argvec ); -} - -namespace -{ namespace util= Alepha::Utility; using namespace Alepha::Testing::exports; diff --git a/Truss/memory.test/examples.cc b/Truss/memory.test/examples.cc index d9ba85f..0019fe0 100644 --- a/Truss/memory.test/examples.cc +++ b/Truss/memory.test/examples.cc @@ -1,11 +1,6 @@ #include using Alepha::Atomic::Turnstile; -int -main() -{ -} - namespace { namespace example1 diff --git a/cmake/rules.cmake b/cmake/rules.cmake index a749940..e9a5d8f 100644 --- a/cmake/rules.cmake +++ b/cmake/rules.cmake @@ -30,6 +30,7 @@ set( FULL_TEST_NAME ${TEST_DOMAIN}.${TEST_NAME} ) add_executable( ${FULL_TEST_NAME} ${TEST_NAME}.cc ) add_test( ${FULL_TEST_NAME} ${FULL_TEST_NAME} ) +target_link_libraries( ${FULL_TEST_NAME} unit-test ) endfunction( unit_test ) diff --git a/comparisons.test/0.cc b/comparisons.test/0.cc index d43d61a..0738ffd 100644 --- a/comparisons.test/0.cc +++ b/comparisons.test/0.cc @@ -10,16 +10,7 @@ namespace { using Alepha::Hydrogen::exports::types::argcnt_t; using Alepha::Hydrogen::exports::types::argvec_t; -} -int -main( const argcnt_t argcnt, const argvec_t argvec ) -{ - return Alepha::Testing::runAllTests( argcnt, argvec ); -} - -namespace -{ using namespace Alepha::Testing::exports; using namespace Alepha::Hydrogen::exports::comparisons; using namespace Alepha::Hydrogen::exports::capabilities; diff --git a/dumbhash.test/0.cc b/dumbhash.test/0.cc index d7a735b..fd30012 100644 --- a/dumbhash.test/0.cc +++ b/dumbhash.test/0.cc @@ -351,9 +351,3 @@ namespace } } } - -int -main( const argcnt_t argcnt, const argvec_t argvec ) -{ - return runAllTests( argcnt, argvec ); -}