]> git.llucax.com Git - software/posixx.git/blobdiff - test/error.cpp
Move type_t and scope_t out from tipc::sockaddr
[software/posixx.git] / test / error.cpp
index 03996b5270e7ceb00a210c971324910d9db584ba..7726da27d1105ae803c0eb35ad31beb4992d2b5c 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <boost/test/unit_test.hpp>
 #include <string>
 
 #include <boost/test/unit_test.hpp>
 #include <string>
-#include <unistd.h>
+#include <fcntl.h>
 
 BOOST_AUTO_TEST_SUITE( error_suite )
 
 
 BOOST_AUTO_TEST_SUITE( error_suite )
 
@@ -11,18 +11,18 @@ BOOST_AUTO_TEST_CASE( constructor_test )
 {
 
        // default constructor
 {
 
        // default constructor
-       close(-123);
+       open("/non/existent", 0);
        posixx::error e1;
        posixx::error e1;
-       BOOST_CHECK_EQUAL(e1.no, EBADF);
+       BOOST_CHECK_EQUAL(e1.no, ENOENT);
 
        // "where" string constructor
 
        // "where" string constructor
-       close(-123);
-       posixx::error e2("fopen");
-       BOOST_CHECK_EQUAL(e2.no, EBADF);
-       BOOST_CHECK_EQUAL(std::string(e2.what()).find("fopen: "), 0);
+       open("/non/existent", 0);
+       posixx::error e2("open");
+       BOOST_CHECK_EQUAL(e2.no, ENOENT);
+       BOOST_CHECK_EQUAL(std::string(e2.what()).find("open: "), 0);
 
        // e1 and e2 should be the same appart from the "where" string
 
        // e1 and e2 should be the same appart from the "where" string
-       BOOST_CHECK_EQUAL(std::string(e2.what()).substr(7), e1.what());
+       BOOST_CHECK_EQUAL(std::string(e2.what()).substr(6), e1.what());
 
 }
 
 
 }