Included first real test
This commit is contained in:
		
							parent
							
								
									34ab2c292e
								
							
						
					
					
						commit
						daa51607c4
					
				@ -8,6 +8,8 @@ FetchContent_Declare(
 | 
				
			|||||||
    googletest
 | 
					    googletest
 | 
				
			||||||
    URL https://github.com/google/googletest/archive/refs/heads/main.zip
 | 
					    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)
 | 
					FetchContent_MakeAvailable(googletest)
 | 
				
			||||||
include_directories(include)
 | 
					include_directories(include)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -22,6 +24,7 @@ add_executable(
 | 
				
			|||||||
target_link_libraries(
 | 
					target_link_libraries(
 | 
				
			||||||
    hello_test
 | 
					    hello_test
 | 
				
			||||||
    gtest
 | 
					    gtest
 | 
				
			||||||
 | 
					    VectorAlgebra
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
include(GoogleTest)
 | 
					include(GoogleTest)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
#include <gtest/gtest.h>
 | 
					#include <gtest/gtest.h>
 | 
				
			||||||
 | 
					#include "Vector3.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Demonstrate some basic assertions
 | 
					// Demonstrate some basic assertions
 | 
				
			||||||
TEST(HelloTest, BasicAssertions) {
 | 
					TEST(HelloTest, BasicAssertions) {
 | 
				
			||||||
@ -8,6 +9,13 @@ TEST(HelloTest, BasicAssertions) {
 | 
				
			|||||||
    EXPECT_EQ(7 * 6, 42);
 | 
					    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) {
 | 
					int main(int argc, char **argv) {
 | 
				
			||||||
    :: testing::InitGoogleTest(&argc, argv);
 | 
					    :: testing::InitGoogleTest(&argc, argv);
 | 
				
			||||||
    return RUN_ALL_TESTS();
 | 
					    return RUN_ALL_TESTS();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user