-// ----------------------------------------------------------------------------
-// long long
-// ----------------------------------------------------------------------------
-
-#ifdef TEST_LONGLONG
-
-#include <wx/longlong.h>
-#include <wx/timer.h>
-
-static void TestSpeed()
-{
- static const long max = 100000000;
- long n;
-
- {
- wxStopWatch sw;
-
- long l = 0;
- for ( n = 0; n < max; n++ )
- {
- l += n;
- }
-
- printf("Summing longs took %ld milliseconds.\n", sw.Time());
- }
-
- {
- wxStopWatch sw;
-
- __int64 l = 0;
- for ( n = 0; n < max; n++ )
- {
- l += n;
- }
-
- printf("Summing __int64s took %ld milliseconds.\n", sw.Time());
- }
-
- {
- wxStopWatch sw;
-
- wxLongLong l;
- for ( n = 0; n < max; n++ )
- {
- l += n;
- }
-
- printf("Summing wxLongLongs took %ld milliseconds.\n", sw.Time());
- }
-}
-
-static void TestDivision()
-{
- #define MAKE_LL(x1, x2, x3, x4) wxLongLong((x1 << 16) | x2, (x3 << 16) | x3)
-
- // seed pseudo random generator
- //srand((unsigned)time(NULL));
-
- size_t nTested = 0;
- for ( size_t n = 0; n < 10000; n++ )
- {
- // get a random wxLongLong (shifting by 12 the MSB ensures that the
- // multiplication will not overflow)
- wxLongLong ll = MAKE_LL((rand() >> 12), rand(), rand(), rand());
-
- wxASSERT( (ll * 1000l)/1000l == ll );
-
- nTested++;
- }
-
- printf("\n*** Tested %u divisions/multiplications: ok\n", nTested);
-
- #undef MAKE_LL
-}
-
-#endif // TEST_LONGLONG
-
-// ----------------------------------------------------------------------------
-// date time
-// ----------------------------------------------------------------------------
-
-#ifdef TEST_TIME
-
-#include <wx/datetime.h>
-
-// this test miscellaneous static wxDateTime functions
-static void TestTimeStatic()
-{
- puts("\n*** wxDateTime static methods test ***");
-
- // some info about the current date
- int year = wxDateTime::GetCurrentYear();
- printf("Current year %d is %sa leap one and has %d days.\n",
- year,
- wxDateTime::IsLeapYear(year) ? "" : "not ",
- wxDateTime::GetNumberOfDays(year));
-
- wxDateTime::Month month = wxDateTime::GetCurrentMonth();
- printf("Current month is '%s' ('%s') and it has %d days\n",
- wxDateTime::GetMonthName(month, TRUE).c_str(),
- wxDateTime::GetMonthName(month).c_str(),
- wxDateTime::GetNumberOfDays(month));
-
- // leap year logic
- static const size_t nYears = 5;
- static const size_t years[2][nYears] =
- {
- // first line: the years to test
- { 1990, 1976, 2000, 2030, 1984, },
-
- // second line: TRUE if leap, FALSE otherwise
- { FALSE, TRUE, TRUE, FALSE, TRUE }
- };
-
- for ( size_t n = 0; n < nYears; n++ )
- {
- int year = years[0][n];
- bool should = years[1][n] != 0;
-
- printf("Year %d is %sa leap year (should be: %s)\n",
- year,
- wxDateTime::IsLeapYear(year) ? "" : "not ",
- should ? "yes" : "no");
-
- wxASSERT( should == wxDateTime::IsLeapYear(year) );
- }
-}
-
-// test constructing wxDateTime objects
-static void TestTimeSet()
-{
- puts("\n*** wxDateTime construction test ***");
-
- printf("Current time:\t%s\n", wxDateTime::Now().Format().c_str());
- printf("Unix epoch:\t%s\n", wxDateTime((time_t)0).Format().c_str());
- printf("Today noon:\t%s\n", wxDateTime(12, 0).Format().c_str());
- printf("May 29, 1976:\t%s\n", wxDateTime(29, wxDateTime::May, 1976).Format().c_str());
-}
-
-// test time zones stuff
-static void TestTimeZones()