~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/test/intltest/itformat.cpp

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/********************************************************************
2
 
 * COPYRIGHT: 
3
 
 * Copyright (c) 1997-2001, International Business Machines Corporation and
4
 
 * others. All Rights Reserved.
5
 
 ********************************************************************/
6
 
 
7
 
/**
8
 
 * IntlTestFormat is the medium level test class for everything in the directory "format".
9
 
 */
10
 
 
11
 
#include "unicode/utypes.h"
12
 
#include "itformat.h"
13
 
#include "tsdate.h"
14
 
#include "tsnmfmt.h"
15
 
#include "caltest.h"
16
 
#include "callimts.h"
17
 
#include "tztest.h"
18
 
#include "tzbdtest.h"
19
 
#include "tsdcfmsy.h"       // DecimalFormatSymbols
20
 
#include "tchcfmt.h"
21
 
#include "tsdtfmsy.h"       // DateFormatSymbols
22
 
#include "dcfmapts.h"       // DecimalFormatAPI
23
 
#include "tfsmalls.h"       // Format Small Classes
24
 
#include "nmfmapts.h"       // NumberFormatAPI
25
 
#include "numfmtst.h"       // NumberFormatTest
26
 
#include "sdtfmtts.h"       // SimpleDateFormatAPI
27
 
#include "dtfmapts.h"       // DateFormatAPI
28
 
#include "dtfmttst.h"       // DateFormatTest
29
 
#include "tmsgfmt.h"        // TestMessageFormat
30
 
#include "dtfmrgts.h"       // DateFormatRegressionTest
31
 
#include "msfmrgts.h"       // MessageFormatRegressionTest
32
 
#include "miscdtfm.h"       // DateFormatMiscTests
33
 
#include "nmfmtrt.h"        // NumberFormatRoundTripTest
34
 
#include "numrgts.h"        // NumberFormatRegressionTest
35
 
#include "dtfmtrtts.h"      // DateFormatRoundTripTest
36
 
#include "pptest.h"         // ParsePositionTest
37
 
#include "calregts.h"       // CalendarRegressionTest
38
 
#include "tzregts.h"        // TimeZoneRegressionTest
39
 
 
40
 
#define TESTCLASS(id, TestClass)          \
41
 
    case id:                              \
42
 
        name = #TestClass;                \
43
 
        if (exec) {                       \
44
 
            logln(#TestClass " test---"); \
45
 
            logln((UnicodeString)"");     \
46
 
            TestClass test;               \
47
 
            callTest(test, par);          \
48
 
        }                                 \
49
 
        break
50
 
 
51
 
void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
52
 
{
53
 
    // for all format tests, always set default Locale and TimeZone to ENGLISH and PST.
54
 
    TimeZone* saveDefaultTimeZone = NULL;
55
 
    Locale  saveDefaultLocale = Locale::getDefault();
56
 
    if (exec) {
57
 
        saveDefaultTimeZone = TimeZone::createDefault();
58
 
        TimeZone *tz = TimeZone::createTimeZone("PST");
59
 
        TimeZone::setDefault(*tz);
60
 
        delete tz;
61
 
        UErrorCode status = U_ZERO_ERROR;
62
 
        Locale::setDefault( Locale::getEnglish(), status );
63
 
        if (U_FAILURE(status)) {
64
 
            errln("itformat: couldn't set default Locale to ENGLISH!");
65
 
        }
66
 
    }
67
 
    if (exec) logln("TestSuite Format: ");
68
 
    switch (index) {
69
 
        TESTCLASS(0,IntlTestDateFormat);
70
 
        TESTCLASS(1,IntlTestNumberFormat);
71
 
        TESTCLASS(2,CalendarTest);
72
 
        TESTCLASS(3,CalendarLimitTest);
73
 
        TESTCLASS(4,TimeZoneTest);
74
 
        TESTCLASS(5,TimeZoneBoundaryTest);
75
 
        TESTCLASS(6,TestChoiceFormat);
76
 
        TESTCLASS(7,IntlTestDecimalFormatSymbols);
77
 
        TESTCLASS(8,IntlTestDateFormatSymbols);
78
 
        TESTCLASS(9,IntlTestDecimalFormatAPI);
79
 
        TESTCLASS(10,TestFormatSmallClasses);
80
 
        TESTCLASS(11,IntlTestNumberFormatAPI);
81
 
        TESTCLASS(12,IntlTestSimpleDateFormatAPI);
82
 
        TESTCLASS(13,IntlTestDateFormatAPI);
83
 
        TESTCLASS(14,DateFormatTest);
84
 
        TESTCLASS(15,TestMessageFormat);
85
 
        TESTCLASS(16,NumberFormatTest);
86
 
        TESTCLASS(17,DateFormatRegressionTest);
87
 
        TESTCLASS(18,MessageFormatRegressionTest);
88
 
        TESTCLASS(19,DateFormatMiscTests);
89
 
        TESTCLASS(20,NumberFormatRoundTripTest);
90
 
        TESTCLASS(21,NumberFormatRegressionTest);
91
 
        TESTCLASS(22,DateFormatRoundTripTest);
92
 
        TESTCLASS(23,ParsePositionTest);
93
 
        TESTCLASS(24,CalendarRegressionTest);
94
 
        TESTCLASS(25,TimeZoneRegressionTest);
95
 
 
96
 
        //TESTCLASS(0,IntlTestDateFormatSymbolsC);
97
 
        //TESTCLASS(0,IntlTestDecimalFormatSymbolsC);
98
 
        //TESTCLASS(0,IntlTestSimpleDateFormatAPIC);
99
 
        //TESTCLASS(0,IntlTestDateFormatAPIC);
100
 
        //TESTCLASS(0,IntlTestDecimalFormatAPIC);
101
 
        //TESTCLASS(0,IntlTestNumberFormatAPIC);
102
 
        //TESTCLASS(0,CNumberSpelloutFormatTest);
103
 
        //TESTCLASS(0,CNumberSpelloutFormatRoundTripTest);
104
 
        //TESTCLASS(0,TestCwrapperFormatSmallClasses);
105
 
        //TESTCLASS(0,TestCwrapperMessageFormat);
106
 
        //TESTCLASS(0,TestCwrapperChoiceFormat);
107
 
        //TESTCLASS(0,TestCwrapperCalendar);
108
 
        //TESTCLASS(0,TestCwrapperTimeZone);
109
 
        default: name = ""; break; //needed to end loop
110
 
    }
111
 
    if (exec) {
112
 
        // restore saved Locale and TimeZone
113
 
        TimeZone::adoptDefault(saveDefaultTimeZone);
114
 
        UErrorCode status = U_ZERO_ERROR;
115
 
        Locale::setDefault( saveDefaultLocale, status );
116
 
        if (U_FAILURE(status)) {
117
 
            errln("itformat: couldn't re-set default Locale!");
118
 
        }
119
 
    }
120
 
}