]>
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 // ----------------------------------------------------------------------------
25 #include "wx/textfile.h"
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class CrtTestCase
: public CppUnit::TestCase
37 CPPUNIT_TEST_SUITE( CrtTestCase
);
38 CPPUNIT_TEST( SetGetEnv
);
39 CPPUNIT_TEST_SUITE_END();
43 DECLARE_NO_COPY_CLASS(CrtTestCase
)
46 // register in the unnamed registry so that these tests are run by default
47 CPPUNIT_TEST_SUITE_REGISTRATION( CrtTestCase
);
49 // also include in it's own registry so that these tests can be run alone
50 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CrtTestCase
, "CrtTestCase" );
52 void CrtTestCase::SetGetEnv()
55 wxSetEnv(_T("TESTVAR"), _T("value"));
56 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val
) == true );
57 CPPUNIT_ASSERT( val
== _T("value") );
58 wxSetEnv(_T("TESTVAR"), _T("something else"));
59 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val
) );
60 CPPUNIT_ASSERT( val
== _T("something else") );
61 CPPUNIT_ASSERT( wxUnsetEnv(_T("TESTVAR")) );
62 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), NULL
) == false );