Initial commit, version 0.1.0.
[libfsafe.git] / tests / AssertPost.cxx
blob918d94ec4c0f285d419a95be29d6d599bce0418d
1 #include <tests/AssertPost.hxx>
2 #include <libfsafe/assert.hxx>
4 void tests::AssertPost::passIfTrue()
6 ASSERT_POST(true);
9 void tests::AssertPost::failIfFalse()
11 ASSERT_POST(false);
14 void tests::AssertPost::testMessage()
16 try {
17 ASSERT_POST(false);
18 CPPUNIT_FAIL("false positive");
19 } catch (libfsafe::AssertionFailure& e) {
20 std::string exp =
21 __FILE__ ":17: "
22 "Postcondition 'false' violated.";
23 std::string act = e.what();
24 CPPUNIT_ASSERT_EQUAL(exp, act);