From 48145587c4c2dc4f1e07d83073e136336c81ce79 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 12 Oct 2018 21:34:07 +0200 Subject: 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 Tested-by: Markus Mohrhard --- examples/simple/ExampleTestCase.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'examples/simple/ExampleTestCase.cpp') 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 ); +} -- cgit v1.2.1