Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable gmock and upgrade gtest to 1.13 #4480

Merged
merged 7 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions barretenberg/cpp/cmake/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ include(FetchContent)
FetchContent_Declare(
GTest
GIT_REPOSITORY https://github.com/google/googletest.git
# Version 1.12.1 is not compatible with WASI-SDK 12
GIT_TAG release-1.10.0
GIT_TAG v1.13.0 #v1.14.0 does not compile with gcc (compiler bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329)
FIND_PACKAGE_ARGS
)

set(BUILD_GMOCK OFF CACHE BOOL "Build with gMock disabled")
set(BUILD_GMOCK ON CACHE BOOL "Build with gMock enabled")
set(INSTALL_GTEST OFF CACHE BOOL "gTest installation disabled")

FetchContent_MakeAvailable(GTest)
Expand Down Expand Up @@ -42,8 +41,6 @@ if (NOT GTest_FOUND)
gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols
)

add_library(GTest::gtest ALIAS gtest)
add_library(GTest::gtest_main ALIAS gtest_main)
endif()

enable_testing()
3 changes: 3 additions & 0 deletions barretenberg/cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ function(barretenberg_module MODULE_NAME)
${MODULE_NAME}_test_objects
PRIVATE
GTest::gtest
GTest::gtest_main
GTest::gmock_main
${TBB_IMPORTED_TARGETS}
)

Expand Down Expand Up @@ -118,6 +120,7 @@ function(barretenberg_module MODULE_NAME)
${ARGN}
GTest::gtest
GTest::gtest_main
GTest::gmock_main
${TBB_IMPORTED_TARGETS}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "barretenberg/vm/avm_trace/AvmMini_opcode.hpp"
#include "barretenberg/vm/tests/helpers.test.hpp"
#include <cstdint>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <string>
#include <utility>
Expand Down Expand Up @@ -64,7 +65,7 @@ TEST_F(AvmMiniExecutionTests, basicAddReturn)
auto instructions = Deserialization::parse(bytecode);

// 2 instructions
EXPECT_EQ(instructions.size(), 2);
EXPECT_THAT(instructions, testing::SizeIs(2));

// ADD
EXPECT_EQ(instructions.at(0).op_code, OpCode::ADD);
Expand Down
Loading