1 // Copyright Leandro Lucarella 2008 - 2010.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file COPYING or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
8 #include <posixx/error.hpp> // posixx::error
10 #include <boost/test/unit_test.hpp>
14 BOOST_AUTO_TEST_SUITE( error_suite )
16 BOOST_AUTO_TEST_CASE( constructor_test )
19 // default constructor
20 open("/non/existent", 0);
22 BOOST_CHECK_EQUAL(e1.no, ENOENT);
24 // "where" string constructor
25 open("/non/existent", 0);
26 posixx::error e2("open");
27 BOOST_CHECK_EQUAL(e2.no, ENOENT);
28 BOOST_CHECK_EQUAL(std::string(e2.what()).find("open: "), 0);
30 // e1 and e2 should be the same appart from the "where" string
31 BOOST_CHECK_EQUAL(std::string(e2.what()).substr(6), e1.what());
35 BOOST_AUTO_TEST_SUITE_END()