Added detector for GMock.

pull/15/head
Jussi Pakkanen 12 years ago
parent 26b79bdefa
commit 867c315e56
  1. 22
      dependencies.py
  2. 27
      test cases/frameworks/3 gmock/gmocktest.cc
  3. 10
      test cases/frameworks/3 gmock/meson.build

@ -124,6 +124,28 @@ class GTestDependency():
def get_sources(self):
return [self.all_src, self.main_src]
class GMockDependency():
def __init__(self, kwargs):
self.libdir = '/usr/lib'
self.libname = 'libgmock.so'
def get_version(self):
return '1.something_maybe'
def get_compile_flags(self):
return []
def get_sources(self):
return []
def get_link_flags(self):
return ['-lgmock']
def found(self):
fname = os.path.join(self.libdir, self.libname)
return os.path.exists(fname)
packages = {'boost': BoostDependency,
'gtest': GTestDependency,
'gmock': GMockDependency,
}

@ -0,0 +1,27 @@
#include<gtest/gtest.h>
#include<gmock/gmock.h>
using ::testing::Return;
class Foo {
public:
Foo() { x = 42; }
virtual ~Foo() {};
virtual int getValue() const { return x; }
private:
int x;
};
class MockFoo : public Foo {
public:
MOCK_CONST_METHOD0(getValue, int());
};
TEST(counttest, once) {
MockFoo f;
EXPECT_CALL(f, getValue()).Times(1).WillOnce(Return(42));
EXPECT_EQ(f.getValue(), 42) << "Got wrong value";
}

@ -0,0 +1,10 @@
project('gmock test', 'cxx')
# Using gmock without gtest is a pain so just
# don't support that then.
gtest = find_dep('gtest', required : true)
gmock = find_dep('gmock', required : true)
e = executable('gmocktest', 'gmocktest.cc', deps : [gtest, gmock])
add_test('gmock test', e)
Loading…
Cancel
Save