ReactOS  0.4.15-dev-3440-g915569a
test_errno.cpp
Go to the documentation of this file.
1 //We are including stdlib.h and stddef.h first because under MSVC
2 //those headers contains a errno macro definition without the underlying value
3 //definition.
4 #include <stdlib.h>
5 #include <stddef.h>
6 
7 #include <errno.h>
8 #include <errno.h> // not typo, check errno def/undef/redef
9 
10 #ifndef _STLP_WCE
11 
12 #include "cppunit/cppunit_proxy.h"
13 
14 //
15 // TestCase class
16 //
17 class ErrnoTest : public CPPUNIT_NS::TestCase
18 {
22 
23 protected:
24  void check();
25 };
26 
28 
30 {
31  //We are using ERANGE as it is part of the C++ ISO (see Table 26 in section 19.3)
32  //Using ERANGE improve the test as it means that the native errno.h file has really
33  //been included.
34  errno = ERANGE;
35 
37  errno = 0;
38 
39 /* Note: in common, you can't write ::errno or std::errno,
40  * due to errno in most cases is just a macro, that frequently
41  * (in MT environment errno is a per-thread value) expand to something like
42  * (*__errno_location()). I don't know way how masquerade such
43  * things: name of macro can't include ::.
44  *
45  * - ptr, 2005-03-30
46  */
47 # if 0
48  if ( ::errno != 0 ) {
49  return 1;
50  }
51  if ( std::errno != 0 ) {
52  return 1;
53  }
54 # endif
55 }
56 #endif // _STLP_WCE
CPPUNIT_TEST_SUITE_END()
int errno
void check()
Definition: test_errno.cpp:29
CPPUNIT_TEST_SUITE(ErrnoTest)
CPPUNIT_TEST_SUITE_REGISTRATION(ErrnoTest)
#define ERANGE
Definition: acclib.h:92
CPPUNIT_TEST(check)
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200