diff options
Diffstat (limited to 'test/gtest-example/example.cpp')
-rw-r--r-- | test/gtest-example/example.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/test/gtest-example/example.cpp b/test/gtest-example/example.cpp deleted file mode 100644 index 794b13cb5..000000000 --- a/test/gtest-example/example.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "gtest/gtest.h" -#include "gmock/gmock.h" - -namespace test -{ - namespace gtest_example - { - TEST(gtest_example, initial_test) - { - EXPECT_TRUE(1 == 1); - ASSERT_FALSE(0 == 1); - //ASSERT_FALSE(0 == 0); // Uncomment this and test will fail - } - } - - namespace gmock_example - { - // Class that we test - class ClassToTest - { - public: - virtual ~ClassToTest(){} - virtual void doAction() = 0; // We will test that doAction will be called - virtual void run() - { - doAction(); - //doAction(); // Uncomment this and test will fail - } - }; - - // Our mock class - class MockClassToTest: public ClassToTest - { - public: - MOCK_METHOD0(doAction, void()); - }; - - TEST(gmock_example, test) - { - MockClassToTest c; - EXPECT_CALL(c, doAction()) - .Times(1) - ; - - c.run(); - } - } -} - -int main(int argc, char **argv) { - ::testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -}
\ No newline at end of file |