summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-10-12 21:34:07 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-11-02 06:03:13 +0100
commit48145587c4c2dc4f1e07d83073e136336c81ce79 (patch)
tree079de5e81b2f62edc0a770b9815c865d775f53d3 /examples
parent4f5cd3b486afb9c7be1903252b4ae3787137a454 (diff)
extensions: add CPPUNIT_TEST_FIXTURE()
This is similar to googletest's TEST_F() macro, allows to avoid spelling out the test name in a suite only once, not 3 times. Change-Id: I90804d271d046d8158678617d8db75ed6ca7c420 Reviewed-on: https://gerrit.libreoffice.org/61732 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/simple/ExampleTestCase.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/simple/ExampleTestCase.cpp b/examples/simple/ExampleTestCase.cpp
index c45109f..823a8df 100644
--- a/examples/simple/ExampleTestCase.cpp
+++ b/examples/simple/ExampleTestCase.cpp
@@ -45,3 +45,18 @@ void ExampleTestCase::testEquals()
CPPUNIT_ASSERT_EQUAL( 12, 13 );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 12.0, 11.99, 0.5 );
}
+
+class FixtureTest : public CPPUNIT_NS::TestFixture
+{
+};
+
+CPPUNIT_TEST_FIXTURE(FixtureTest, testEquals)
+{
+ CPPUNIT_ASSERT_EQUAL( 12, 12 );
+}
+
+CPPUNIT_TEST_FIXTURE(FixtureTest, testAdd)
+{
+ double result = 2.0 + 2.0;
+ CPPUNIT_ASSERT( result == 4.0 );
+}