From 1224a57d06abb042e30be2621a1ee2eba0c9866e Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sun, 4 Aug 2019 22:44:06 -0700 Subject: [PATCH] Bring vector.h to 100% coverage. --- CMakeLists.txt | 11 ++--------- test/vector_test.cc | 32 +++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d526c24..97be40b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,8 @@ if(DEFINED ENV{CMAKE_GCOV}) add_compile_options(-fprofile-arcs -ftest-coverage) # Need CMake 3.15+. add_link_options(-fprofile-arcs -ftest-coverage) -add_custom_target(coverage COMMAND lcov -d . -t wrmath -o wrmath.info -c +add_custom_target(coverage COMMAND lcov -d . -t wrmath -o wrmath.info -c -i + COMMAND lcov -d . -t wrmath -o wrmath.info -c COMMAND genhtml -o coverage-report wrmath.info) endif() @@ -27,14 +28,6 @@ file(GLOB_RECURSE ${PROJECT_NAME}_SOURCES src/*.cc) ## BUILD add_library(lib${PROJECT_NAME} ${${PROJECT_NAME}_SOURCES}) -# add_library(LIBNAME -# SOURCES -# ) -# -# add_executable(EXE_NAME MAIN) -# target_link_libraries(EXE_NAME LIBNAMES) -# add_dependencies(EXE_NAME LIBNAMES) - ## INSTALL diff --git a/test/vector_test.cc b/test/vector_test.cc index 6f67aad..15b4932 100644 --- a/test/vector_test.cc +++ b/test/vector_test.cc @@ -6,7 +6,7 @@ using namespace std; using namespace wr; -TEST(Vector3Miscellaneous, ExtractionOperator) +TEST(Vector3Miscellaneous, ExtractionOperator3d) { geom::Vector3d vec {1.0, 2.0, 3.0}; stringstream vecBuffer; @@ -16,6 +16,36 @@ TEST(Vector3Miscellaneous, ExtractionOperator) } +TEST(Vector3Miscellaneous, ExtractionOperator3f) +{ + geom::Vector3f vec {1.0, 2.0, 3.0}; + stringstream vecBuffer; + + vecBuffer << vec; + EXPECT_EQ(vecBuffer.str(), "<1, 2, 3>"); +} + + +TEST(Vector3Miscellaneous, ExtractionOperator4d) +{ + geom::Vector4d vec {1.0, 2.0, 3.0, 4.0}; + stringstream vecBuffer; + + vecBuffer << vec; + EXPECT_EQ(vecBuffer.str(), "<1, 2, 3, 4>"); +} + + +TEST(Vector3Miscellaneous, ExtractionOperator4f) +{ + geom::Vector4f vec {1.0, 2.0, 3.0, 4.0}; + stringstream vecBuffer; + + vecBuffer << vec; + EXPECT_EQ(vecBuffer.str(), "<1, 2, 3, 4>"); +} + + TEST(Vector3Miscellaneous, SetEpsilon) { geom::Vector3f a {1.0, 1.0, 1.0};