]>
git.saurik.com Git - wxWidgets.git/blob - tests/formatconverter/formattest.cpp
2 * Tester for wxFormatConverter, by M. J. Wetherell
4 * Reads stdin, expects two column input (as produced by formats.pl or
5 * formats2.pl), the first column contains the test pattern, the second
8 * The output is any patterns that wxFormatConveter doesn't transform to the
9 * expected value, in three columns: input, expected, output.
11 * ./formats.pl | ./formattest
12 * ./formats2.pl | ./formattest
16 #include <wx/wfstream.h>
17 #include <wx/txtstrm.h>
20 /* This function is in wxchar.cpp to give access to wxFormatConverter,
21 * but only in debug mode.
25 extern wxString
wxConvertFormat(const wxChar
*format
);
28 class TestApp
: public wxAppConsole
34 IMPLEMENT_APP_CONSOLE(TestApp
)
39 wxFFileInputStream
in(stdin
);
40 wxTextInputStream
txt(in
, _T("\t"));
43 wxString format
= txt
.ReadWord();
44 wxString expected
= txt
.ReadWord();
46 wxString converted
= wxConvertFormat(format
);
48 if (converted
!= expected
)
49 std::cout
<< "'" << format
.mb_str() << "'\t"
50 << "'" << expected
.mb_str() << "'\t"
51 << "'" << converted
.mb_str() << "'\n";
54 std::cout
<< "Please compile this test program in debug mode.\n";