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