Skip to content

inazarenko/protobuf-matchers

Repository files navigation

GMock matchers for protocol buffers

A library of matchers for protocol buffer message objects, for unit tests written using Google Test framework. E.g.

  #include "protobuf-matchers/protocol-buffer-matchers.h"
  ...
  using ::protobuf_matchers::EqualsProto;
  using ::protobuf_matchers::Approximately;
  using ::protobuf_matchers::Partially;
  ...
  EXPECT_THAT(msg, EqualsProto("val: 10.0 is_null: false"));
  EXPECT_THAT(msg, Partially(Approximately(EqualsProto("val: 10.0000001"))));

Matcher code was released within Nucleus project. This fork removes dependencies on Tensorflow and the rest of the Nucleus code.

Build with Bazel

Nix shell (optional)

nix-shell -p stdenv bazel_5 jdk11_headless

Build and test

bazel build --cxxopt=-std=c++17 //protobuf-matchers:protobuf-matchers-test

Build with CMake

Install dependencies from Conan (optional)

conan install . -if build -s build_type=Debug

Build and test

cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Debug
cmake --build build
ctest --test-dir build --verbose