2 #include <posixx/error.hpp> // posixx::error
4 #include <boost/test/unit_test.hpp>
8 BOOST_AUTO_TEST_SUITE( error_suite )
10 BOOST_AUTO_TEST_CASE( constructor_test )
13 // default constructor
14 open("/non/existent", 0);
16 BOOST_CHECK_EQUAL(e1.no, ENOENT);
18 // "where" string constructor
19 open("/non/existent", 0);
20 posixx::error e2("open");
21 BOOST_CHECK_EQUAL(e2.no, ENOENT);
22 BOOST_CHECK_EQUAL(std::string(e2.what()).find("open: "), 0);
24 // e1 and e2 should be the same appart from the "where" string
25 BOOST_CHECK_EQUAL(std::string(e2.what()).substr(6), e1.what());
29 BOOST_AUTO_TEST_SUITE_END()