summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-26 22:55:32 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-26 22:55:32 -0500
commit9f366f4748187aabe796e8f6563f6cbb7c2c7cfe (patch)
tree6d8d6f6568b7dcd78972a83f2899d0a4a1dafdaf
parent498b16ee572b35eee04a58d826d8ff2118006727 (diff)
chore: tests: updating codegen unit tests.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--tests/samples/sample.cc (renamed from tests/test_02_linker/sample/sample.cc)0
-rw-r--r--tests/test_01_codegen/CMakeLists.txt23
-rw-r--r--tests/test_01_codegen/codegen_test.cc14
-rw-r--r--tests/test_02_linker/linker_test.cc6
-rw-r--r--tests/test_02_linker/sample/sample.cc.pp3
5 files changed, 40 insertions, 6 deletions
diff --git a/tests/test_02_linker/sample/sample.cc b/tests/samples/sample.cc
index 4cce7f6..4cce7f6 100644
--- a/tests/test_02_linker/sample/sample.cc
+++ b/tests/samples/sample.cc
diff --git a/tests/test_01_codegen/CMakeLists.txt b/tests/test_01_codegen/CMakeLists.txt
new file mode 100644
index 0000000..8b782d5
--- /dev/null
+++ b/tests/test_01_codegen/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 3.10)
+project(NeCTICodeGen)
+
+include(FetchContent)
+FetchContent_Declare(
+ googletest
+ URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
+)
+
+# For Windows: Prevent overriding the parent project's compiler/linker settings
+set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+FetchContent_MakeAvailable(googletest)
+
+enable_testing()
+
+add_executable(CodegenTestBasic linker_test.cc)
+target_link_libraries(CodegenTestBasic gtest_main)
+
+set_property(TARGET CodegenTestBasic PROPERTY CXX_STANDARD 20)
+target_include_directories(CodegenTestBasic PUBLIC ../../)
+
+include(GoogleTest)
+gtest_discover_tests(CodegenTestBasic)
diff --git a/tests/test_01_codegen/codegen_test.cc b/tests/test_01_codegen/codegen_test.cc
new file mode 100644
index 0000000..89afd8d
--- /dev/null
+++ b/tests/test_01_codegen/codegen_test.cc
@@ -0,0 +1,14 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+ ======================================== */
+
+/// @brief Codegen Unit test, from the C++ unit to the final executable.
+/// @author Amlal El Mahrouss
+
+#include <gtest/gtest.h>
+
+TEST(CodegenTest, BasicCodegenTest) {
+
+}
diff --git a/tests/test_02_linker/linker_test.cc b/tests/test_02_linker/linker_test.cc
index cc580a3..758180e 100644
--- a/tests/test_02_linker/linker_test.cc
+++ b/tests/test_02_linker/linker_test.cc
@@ -11,12 +11,12 @@
TEST(LinkerTest, BasicLinkTest) {
/// @note this is the driver, it will look for a .cc.pp (.pp stands for pre-processed)
- auto expr = std::system("pef-amd64-cxxdrv sample/sample.cc");
+ auto expr = std::system("pef-amd64-cxxdrv ../samples/sample.cc");
EXPECT_TRUE(expr == 0) << "C++ Driver did not compile the easy C++ unit.";
- expr = std::system("asm -asm:x64 sample/sample.cc.pp.masm");
+ expr = std::system("asm -asm:x64 ../samples/sample.cc.pp.masm");
EXPECT_TRUE(expr == 0) << "Assembler did not assemble the easy asm unit.";
- expr = std::system("ld64 -amd64 sample/sample.cc.pp.obj -start __NECTI_main -output main.exec");
+ expr = std::system("ld64 -amd64 ../samples/sample.cc.pp.obj -start __NECTI_main -output main.exec");
EXPECT_TRUE(expr == 0) << "Linker did not link the easy object.";
}
diff --git a/tests/test_02_linker/sample/sample.cc.pp b/tests/test_02_linker/sample/sample.cc.pp
deleted file mode 100644
index cb3f748..0000000
--- a/tests/test_02_linker/sample/sample.cc.pp
+++ /dev/null
@@ -1,3 +0,0 @@
-int main() {
- return 0;
-}