Basically got exception handling down. Still working on assertion handling.
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <vector>
|
||||
#include <jlog/jlog.hpp>
|
||||
|
||||
//#define NDEBUG for disabling assert, but tests still end up passing.
|
||||
|
||||
// TODO: Move implementation to jtest::detail
|
||||
// have this file primarily expose the macros intended for users
|
||||
|
||||
|
16
main.cpp
16
main.cpp
@@ -10,6 +10,7 @@
|
||||
// TODO: Provide benchmarking on test running-time
|
||||
|
||||
#include <jtest/jtest.hpp>
|
||||
#include <cassert>
|
||||
|
||||
void TestA() { jtest::check("Bruh" == "Bruh"); }
|
||||
void TestB() { jtest::check(6*6 == 36); }
|
||||
@@ -33,12 +34,21 @@ int main(int argc, char** argv)
|
||||
//jtest::check(2+2 == 4);
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
TEST("Test4", []
|
||||
{
|
||||
assert(false);
|
||||
//assert(69 == 9);//, "FUCKING COCK"); stil figuring out
|
||||
});
|
||||
|
||||
TEST("Test5", []
|
||||
{
|
||||
throw std::runtime_error("HOLY SHIT");
|
||||
});
|
||||
|
||||
TEST("Test6", []
|
||||
{
|
||||
throw std::exception();
|
||||
});
|
||||
*/
|
||||
|
||||
TEST("TestGroup::A", TestA);
|
||||
TEST("TestGroup::B", TestB);
|
||||
|
@@ -89,6 +89,8 @@ namespace jtest {
|
||||
try { callback(); }
|
||||
catch(const std::exception& e)
|
||||
{ passed = false; }
|
||||
catch(...) // <- Basically covers all exception cases. GTest does something similar
|
||||
{ passed = false; }
|
||||
|
||||
rantests++;
|
||||
|
||||
@@ -106,7 +108,6 @@ namespace jtest {
|
||||
for (testdef& td : testlist)
|
||||
{
|
||||
td.passed = test(td.testname, td.callback, td.file, td.line);
|
||||
|
||||
}
|
||||
|
||||
jlog::log(log_test_tracking_format());
|
||||
|
Reference in New Issue
Block a user