4 Commits

Author SHA1 Message Date
21cc5313f2 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	include/jtest/jtest.hpp
2024-06-25 10:28:00 -04:00
ab57cd5774 Fix testdef structure 2024-06-25 10:27:52 -04:00
e04b742954 Fixed a bug that caused the testname to not be printed. 2024-06-24 18:23:49 -07:00
6954f51793 Fix CMakeLists.txt to propagate dependencies 2024-06-24 15:09:12 -04:00
2 changed files with 10 additions and 5 deletions

View File

@@ -35,8 +35,6 @@ CPMAddPackage(
URL https://git.redacted.cc/josh/jlog/archive/Prerelease-5.zip
)
include_directories(${Event_SOURCE_DIR}/include)
include_directories(${jlog_SOURCE_DIR}/include)
if (UNIX)
add_library(jtest SHARED ${jtest_SRC})
@@ -46,6 +44,10 @@ if (WIN32)
add_library(jtest STATIC ${jtest_SRC})
endif()
target_include_directories(jtest PUBLIC ${Event_SOURCE_DIR}/include)
target_include_directories(jtest PUBLIC ${jlog_SOURCE_DIR}/include)
target_include_directories(jtest PUBLIC ${PROJECT_SOURCE_DIR}/include)

View File

@@ -15,9 +15,9 @@ namespace jtest {
// -maxine
struct testdef
{
const std::string& testname;
const std::function<void()>& callback;
const std::string file; // <- & is not needed here -maxine
std::string testname;
std::function<void()> callback;
std::string file; // <- & is not needed here -maxine
int line;
bool passed;
};
@@ -33,6 +33,9 @@ namespace jtest {
testlist.push_back(testdef(testname, callback, file, line));
}
// TODO: Implement check variants
// TODO: implement streaming a custom failure message with << operator
// i.e. : check(my_cond) << "The condition is not true!"
bool check(bool condition) {
if (!condition)
throw std::runtime_error("Test check failed!!");