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