ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

test_errno.cpp
Go to the documentation of this file.
00001 //We are including stdlib.h and stddef.h first because under MSVC
00002 //those headers contains a errno macro definition without the underlying value
00003 //definition.
00004 #include <stdlib.h>
00005 #include <stddef.h>
00006 
00007 #include <errno.h>
00008 #include <errno.h> // not typo, check errno def/undef/redef
00009 
00010 #ifndef _STLP_WCE
00011 
00012 #include "cppunit/cppunit_proxy.h"
00013 
00014 //
00015 // TestCase class
00016 //
00017 class ErrnoTest : public CPPUNIT_NS::TestCase
00018 {
00019   CPPUNIT_TEST_SUITE(ErrnoTest);
00020   CPPUNIT_TEST(check);
00021   CPPUNIT_TEST_SUITE_END();
00022 
00023 protected:
00024   void check();
00025 };
00026 
00027 CPPUNIT_TEST_SUITE_REGISTRATION(ErrnoTest);
00028 
00029 void ErrnoTest::check()
00030 {
00031   //We are using ERANGE as it is part of the C++ ISO (see Table 26 in section 19.3)
00032   //Using ERANGE improve the test as it means that the native errno.h file has really
00033   //been included.
00034   errno = ERANGE;
00035 
00036   CPPUNIT_ASSERT( errno == ERANGE );
00037   errno = 0;
00038 
00039 /* Note: in common, you can't write ::errno or std::errno,
00040  * due to errno in most cases is just a macro, that frequently
00041  * (in MT environment errno is a per-thread value) expand to something like
00042  * (*__errno_location()). I don't know way how masquerade such
00043  * things: name of macro can't include ::.
00044  *
00045  *                - ptr, 2005-03-30
00046  */
00047 # if 0
00048   if ( ::errno != 0 ) {
00049     return 1;
00050   }
00051   if ( std::errno != 0 ) {
00052     return 1;
00053   }
00054 # endif
00055 }
00056 #endif // _STLP_WCE

Generated on Sun May 27 2012 04:35:52 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.