forked from Alepha/Alepha
More testing.
This commit is contained in:
2
Testing/TableTest.test/CMakeLists.txt
Normal file
2
Testing/TableTest.test/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
unit_test( test )
|
||||
unit_test( test2 )
|
||||
39
Testing/TableTest.test/test.cc
Normal file
39
Testing/TableTest.test/test.cc
Normal file
@ -0,0 +1,39 @@
|
||||
static_assert( __cplusplus > 2020'00 );
|
||||
|
||||
#include <Alepha/Testing/test.h>
|
||||
#include <Alepha/Testing/TableTest.h>
|
||||
#include <Alepha/Utility/evaluation.h>
|
||||
|
||||
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;
|
||||
using namespace UnitTest::literals;
|
||||
using UnitTest::TableTest;
|
||||
|
||||
auto registration= enroll <=[]
|
||||
{
|
||||
"enroll.basic.success"_test <=[]{};
|
||||
-"enroll.basic.failure"_test <=[]{ throw 0; };
|
||||
};
|
||||
|
||||
auto named1= "named.basic.success"_test <= []{};
|
||||
auto named2= -"named.basic.failure"_test <=[]{ return 1; };
|
||||
|
||||
int identity( int a ){ return a; }
|
||||
auto namedTable1= "named.table.success"_test <=TableTest< identity >::Cases
|
||||
{
|
||||
{ "smoke", { 1 }, 1 },
|
||||
//{ "fail", { 2 }, 1 },
|
||||
};
|
||||
}
|
||||
45
Testing/TableTest.test/test2.cc
Normal file
45
Testing/TableTest.test/test2.cc
Normal file
@ -0,0 +1,45 @@
|
||||
static_assert( __cplusplus > 2020'00 );
|
||||
|
||||
#include <Alepha/Testing/TableTest.h>
|
||||
#include <Alepha/Testing/test.h>
|
||||
#include <Alepha/Utility/evaluation.h>
|
||||
|
||||
|
||||
int
|
||||
main( const int argcnt, const char *const *const argvec )
|
||||
{
|
||||
return Alepha::Testing::runAllTests( argcnt, argvec );
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace Alepha::Testing::exports;
|
||||
using namespace Alepha::Utility::exports::evaluation;
|
||||
|
||||
int
|
||||
add( int a, int b )
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
auto basic_test= "basic_test"_test <=[]
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
|
||||
auto test= "addition.two.test"_test <=TableTest< add >::Cases
|
||||
{
|
||||
{ "Basic Smoke Test", { 2, 2 }, 4 },
|
||||
{ "Lefthand identity", { 0, 25 }, 25 },
|
||||
{ "Righthand identity", { 25, 0 }, 25 },
|
||||
};
|
||||
|
||||
auto alltests= enroll <=[]
|
||||
{
|
||||
"addition.two.local"_test <=TableTest< add >::Cases
|
||||
{
|
||||
{ "Negative case", { -10, -20 }, -30 },
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user