Compare commits

..

2 commits

Author SHA1 Message Date
c4b9bd8359
fix: failing tests in test.tests.cpp
Some checks failed
continuous-integration/drone/pr Build is failing
2025-07-16 13:20:36 +03:30
f457e5ae19
refactor: test result output issues 2025-07-16 13:18:08 +03:30
2 changed files with 17 additions and 5 deletions

View file

@ -46,10 +46,10 @@ public:
test(); test();
} }
std::cout << "_________________________[TEST RESULTS]_________________________"; std::cout << "_________________________[TEST RESULTS]_________________________\n";
std::cout << "Ran " << instance().m_failed_count + instance().m_pasesed_count << " tests:\n" std::cout << "Ran " << instance().m_failed_count + instance().m_pasesed_count << " tests:\n"
<< "Passed: " << instance().m_pasesed_count << '\n' << "\tpassed: " << instance().m_pasesed_count << '\n'
<< "Failed: " << instance().m_failed_count << '\n'; << "\tfailed: " << instance().m_failed_count << '\n';
return instance().m_failed_count; return instance().m_failed_count;
} }
@ -100,6 +100,7 @@ struct Case
return; // TODO(Light): Should we run the remaining tests after a failure? return; // TODO(Light): Should we run the remaining tests after a failure?
} }
details::Registry::increment_passed_count();
std::cout << " --> SUCCESS :D" << "\n"; std::cout << " --> SUCCESS :D" << "\n";
} }

View file

@ -2,6 +2,7 @@
lt::test::Suite meta = []() { lt::test::Suite meta = []() {
using lt::test::expect_eq; using lt::test::expect_eq;
using lt::test::expect_true;
lt::test::Case { "test_1" } = [] { lt::test::Case { "test_1" } = [] {
expect_eq(5, 5); expect_eq(5, 5);
@ -12,7 +13,18 @@ lt::test::Suite meta = []() {
}; };
lt::test::Case { "test_3" } = [] { lt::test::Case { "test_3" } = [] {
expect_eq(true, false); auto exception_thrown = false;
try
{
expect_eq(true, false);
}
catch (const std::exception &exp)
{
exception_thrown = true;
}
expect_true(exception_thrown);
}; };
lt::test::Case { "test_4" } = [] { lt::test::Case { "test_4" } = [] {
@ -20,6 +32,5 @@ lt::test::Suite meta = []() {
}; };
lt::test::Case { "test_5" } = [] { lt::test::Case { "test_5" } = [] {
throw std::runtime_error("Uncaught std exception!");
}; };
}; };