summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt20
-rw-r--r--tests/test_logger.cpp15
-rw-r--r--tests/test_main.cpp14
3 files changed, 49 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..67baeda
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Unit tests for BoltDBG
+
+# Optionally enable sanitizers for test builds
+if(BOLTDBG_ENABLE_ASAN)
+ add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
+ add_link_options(-fsanitize=address)
+endif()
+
+# Collect test sources
+set(TEST_SOURCES
+ test_main.cpp
+ test_logger.cpp
+)
+
+add_executable(boltdbg_tests ${TEST_SOURCES})
+target_include_directories(boltdbg_tests PRIVATE ${CMAKE_SOURCE_DIR}/include)
+target_link_libraries(boltdbg_tests PRIVATE libboltdbg)
+
+# If using CTest (already enabled from top-level)
+add_test(NAME boltdbg_tests COMMAND boltdbg_tests)
diff --git a/tests/test_logger.cpp b/tests/test_logger.cpp
new file mode 100644
index 0000000..536383b
--- /dev/null
+++ b/tests/test_logger.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+//#include "../src/util/logger.h"
+
+void run_logger_tests(int &passed, int &failed) {
+ std::cout << "Running logger tests...\n";
+
+ try {
+ //log(LogLevel::Info, "Test info message");
+ //log(LogLevel::Warn, "Test warning message");
+ //log(LogLevel::Error, "Test error message");
+ //passed++;
+ } catch (...) {
+ failed++;
+ }
+}
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
new file mode 100644
index 0000000..5b22560
--- /dev/null
+++ b/tests/test_main.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+int main() {
+ std::cout << "[BoltDBG] Running tests...\n";
+ int passed = 0, failed = 0;
+
+ extern void run_logger_tests(int&, int&);
+ run_logger_tests(passed, failed);
+
+ std::cout << "Tests passed: " << passed << "\n";
+ std::cout << "Tests failed: " << failed << "\n";
+
+ return failed > 0 ? 1 : 0;
+}