ReactOS
0.4.16-dev-340-g0540c21
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
{
19
CPPUNIT_TEST_SUITE
(
ErrnoTest
);
20
CPPUNIT_TEST
(
check
);
21
CPPUNIT_TEST_SUITE_END
();
22
23
protected
:
24
void
check
();
25
};
26
27
CPPUNIT_TEST_SUITE_REGISTRATION
(
ErrnoTest
);
28
29
void
ErrnoTest::check
()
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
36
CPPUNIT_ASSERT
(
errno
==
ERANGE
);
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
ERANGE
#define ERANGE
Definition:
acclib.h:92
ErrnoTest
Definition:
test_errno.cpp:18
ErrnoTest::CPPUNIT_TEST_SUITE_END
CPPUNIT_TEST_SUITE_END()
ErrnoTest::check
void check()
Definition:
test_errno.cpp:29
ErrnoTest::CPPUNIT_TEST
CPPUNIT_TEST(check)
ErrnoTest::CPPUNIT_TEST_SUITE
CPPUNIT_TEST_SUITE(ErrnoTest)
CPPUNIT_TEST_SUITE_REGISTRATION
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition:
cppunit_mini.h:193
CPPUNIT_ASSERT
#define CPPUNIT_ASSERT(X)
Definition:
cppunit_mini.h:200
cppunit_proxy.h
errno
#define errno
Definition:
errno.h:18
sdk
lib
3rdparty
stlport
test
unit
test_errno.cpp
Generated on Thu Dec 12 2024 06:13:07 for ReactOS by
1.9.6