From 2a98d8e75d02ee379a5108c6b934d79e71b447f7 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Fri, 29 Sep 2023 14:49:06 -0700 Subject: [PATCH] trying with gmock to find matches seems that's where the code is https://github.com/google/googletest/blob/e47544ad31cb3ceecd04cc13e8fe556f8df9fe0b/googlemock/include/gmock/gmock-matchers.h#L3724 --- tests/CMakeLists.txt | 2 +- tests/functions.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9014eb2..3fdfcfe 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,6 +2,6 @@ find_package(GTest REQUIRED CONFIG) include(GoogleTest) add_executable(${PROJECT_NAME}Tests criterions.cpp functions.cpp operations.cpp subscripts.cpp) -target_link_libraries(${PROJECT_NAME}Tests PRIVATE ${PROJECT_NAME} GTest::gtest GTest::gtest_main) +target_link_libraries(${PROJECT_NAME}Tests PRIVATE ${PROJECT_NAME} GTest::gtest GTest::gtest_main GTest::gmock) target_compile_features(${PROJECT_NAME}Tests PRIVATE cxx_std_20) gtest_add_tests(TARGET ${PROJECT_NAME}Tests) diff --git a/tests/functions.cpp b/tests/functions.cpp index 6ce0ae7..0e3e644 100644 --- a/tests/functions.cpp +++ b/tests/functions.cpp @@ -1,5 +1,8 @@ #include "CaberNet.h" #include +#include + +using ::testing::ElementsAre; TEST(functions, gradient) { /* @@ -45,7 +48,7 @@ TEST(functions, gradient) { ASSERT_TRUE(diff_x.empty()); - ASSERT_THAT(x, testing::ElementsAre(0, 34, 0, 0, 0, 79, 17, 27)); + EXPECT_THAT(x, ElementsAre(0, 34, 0, 0, 0, 79, 17, 27)); // ASSERT_EQ([0, 0, 0, 5, 7, 9, 4, 5, 6, 4, 5, 6], w.gradient()); // ASSERT_EQ([0, 2, 1, 1], b.gradient()); }