]>
git.saurik.com Git - wxWidgets.git/blob - tests/strings/crt.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/strings/crt.cpp
3 // Purpose: Test for wx C runtime functions wrappers
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2004 Vaclav Slavik
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ----------------------------------------------------------------------------
13 // ----------------------------------------------------------------------------
15 #include "wx/wxprec.h"
25 #include "wx/textfile.h"
27 #include "wx/cppunit.h"
29 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 class CrtTestCase
: public CppUnit::TestCase
39 CPPUNIT_TEST_SUITE( CrtTestCase
);
40 CPPUNIT_TEST( SetGetEnv
);
41 CPPUNIT_TEST_SUITE_END();
45 DECLARE_NO_COPY_CLASS(CrtTestCase
)
48 // register in the unnamed registry so that these tests are run by default
49 CPPUNIT_TEST_SUITE_REGISTRATION( CrtTestCase
);
51 // also include in it's own registry so that these tests can be run alone
52 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CrtTestCase
, "CrtTestCase" );
54 void CrtTestCase::SetGetEnv()
57 wxSetEnv(_T("TESTVAR"), _T("value"));
58 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val
) == true );
59 CPPUNIT_ASSERT( val
== _T("value") );
60 wxSetEnv(_T("TESTVAR"), _T("something else"));
61 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val
) );
62 CPPUNIT_ASSERT( val
== _T("something else") );
63 CPPUNIT_ASSERT( wxUnsetEnv(_T("TESTVAR")) );
64 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), NULL
) == false );