diff --git a/CMakeLists.txt b/CMakeLists.txt index 69c8ed0..33c5b2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/refs/heads/main.zip ) +# For Windows: Prevent overriding the parent project's compiler/linker settings +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) include_directories(include) @@ -22,6 +24,7 @@ add_executable( target_link_libraries( hello_test gtest + VectorAlgebra ) include(GoogleTest) diff --git a/test/hello_test.cc b/test/hello_test.cc index cf48e8f..020866a 100644 --- a/test/hello_test.cc +++ b/test/hello_test.cc @@ -1,4 +1,5 @@ #include +#include "Vector3.h" // Demonstrate some basic assertions TEST(HelloTest, BasicAssertions) { @@ -8,6 +9,13 @@ TEST(HelloTest, BasicAssertions) { EXPECT_EQ(7 * 6, 42); } +TEST(VectorNormalize, BasicAssertions) { + Vector3 v = Vector3(0, 2, 0); + Vector3 normalizedV = v.normalized(); + bool r = normalizedV == Vector3(0, 1, 0); + ASSERT_EQ(r, true); +} + int main(int argc, char **argv) { :: testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS();