Included first real test

This commit is contained in:
Pascal Serrarens 2022-01-24 11:50:34 +01:00
parent 34ab2c292e
commit daa51607c4
2 changed files with 11 additions and 0 deletions

View File

@ -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)

View File

@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#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();