Skip to content

Commit

Permalink
Experiment to enable gmock
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Feb 7, 2024
1 parent 0a8905a commit aa9df44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions barretenberg/cpp/cmake/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ 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.14.0
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 +42,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

0 comments on commit aa9df44

Please sign in to comment.