Bring vector.h to 100% coverage.

This commit is contained in:
Kyle Isom 2019-08-04 22:44:06 -07:00
parent 88be5bfe01
commit 1224a57d06
2 changed files with 33 additions and 10 deletions

View File

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

View File

@ -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};