#define TEST_WCHAR
#define TEST_ZIP
#else // #if TEST_ALL
- #define TEST_INFO_FUNCTIONS
+ #define TEST_FILE
#endif
// some tests are interactive, define this to run them
static void ShowCmdLine(const wxCmdLineParser& parser)
{
- wxString s = _T("Input files: ");
+ wxString s = _T("Command line parsed successfully:\nInput files: ");
size_t count = parser.GetParamCount();
for ( size_t param = 0; param < count; param++ )
wxPuts(wxEmptyString);
}
+static void TestTempFile()
+{
+ wxPuts(_T("*** wxTempFile test ***"));
+
+ wxTempFile tmpFile;
+ if ( tmpFile.Open(_T("test2")) && tmpFile.Write(_T("the answer is 42")) )
+ {
+ if ( tmpFile.Commit() )
+ wxPuts(_T("File committed."));
+ else
+ wxPuts(_T("ERROR: could't commit temp file."));
+
+ wxRemoveFile(_T("test2"));
+ }
+
+ wxPuts(wxEmptyString);
+}
+
#endif // TEST_FILE
// ----------------------------------------------------------------------------
#include "wx/utils.h"
+#if TEST_INTERACTIVE
static void TestDiskInfo()
{
wxPuts(_T("*** Testing wxGetDiskSpace() ***"));
}
}
}
+#endif // TEST_INTERACTIVE
static void TestOsInfo()
{
fsOut.Write("foo", 3);
}
- wxFileInputStream fsIn(filename);
- wxPrintf(_T("File stream size: %u\n"), fsIn.GetSize());
- while ( !fsIn.Eof() )
{
- wxPutchar(fsIn.GetC());
+ wxFileInputStream fsIn(filename);
+ wxPrintf(_T("File stream size: %u\n"), fsIn.GetSize());
+ while ( !fsIn.Eof() )
+ {
+ wxPutchar(fsIn.GetC());
+ }
}
if ( !wxRemoveFile(filename) )
TestFileRead();
TestTextFileRead();
TestFileCopy();
+ TestTempFile();
#endif // TEST_FILE
#ifdef TEST_FILENAME