gmock stub

This commit is contained in:
Joe Thornber 2013-03-22 10:55:55 +00:00
parent a560e672b9
commit e3375443eb
3 changed files with 50 additions and 0 deletions

0
lib/.ignore_me Normal file
View File

View File

@ -74,4 +74,27 @@ unit-tests/metadata_t: unit-tests/metadata_t.o $(OBJECTS)
unit-tests/endian_t: unit-tests/endian_t.o $(OBJECTS) unit-tests/endian_t: unit-tests/endian_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT) g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
#----------------------------------------------------------------
# gmock tests
GMOCK_DIR=gmock-1.6.0/
GMOCK_INCLUDES=\
-Igmock-1.6.0/include \
-Igmock-1.6.0/gtest/include
GMOCK_LIBS=\
-Llib -lgmock -lpthread
lib/gmock.a:
g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/gtest -c $(GMOCK_DIR)/gtest/src/gtest-all.cc
g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR) -c $(GMOCK_DIR)/src/gmock-all.cc
ar -rv lib/libgmock.a gtest-all.o gmock-all.o
unit-tests/gmock_t.o: unit-tests/gmock_t.cc
g++ -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) -o $@ $<
unit-tests/gmock_t: unit-tests/gmock_t.o lib/gmock.a
g++ $(CXXFLAGS) -o $@ $< $(LIBS) $(GMOCK_LIBS)
all: $(TEST_PROGRAMS) all: $(TEST_PROGRAMS)

27
unit-tests/gmock_t.cc Normal file
View File

@ -0,0 +1,27 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
//----------------------------------------------------------------
namespace {
class MyClass {
};
}
//----------------------------------------------------------------
TEST(MyClass, can_construct)
{
MyClass c;
}
//----------------------------------------------------------------
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
//----------------------------------------------------------------