]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/tests/framework/src/com/ibm/icu/dev/test/sample/ModuleTestSampleData.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / tests / framework / src / com / ibm / icu / dev / test / sample / ModuleTestSampleData.java
1 /**\r
2  *******************************************************************************\r
3  * Copyright (C) 2001-2004, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 package com.ibm.icu.dev.test.sample;\r
8 \r
9 import java.util.ListResourceBundle;\r
10 \r
11 /**\r
12  * This is sample data for ModuleTestSample, which is an illustration\r
13  * of a subclass of ModuleTest.  This data is in a format which\r
14  * is understood by ResourceModule, which for simplicity expects\r
15  * all data, including numeric and boolean data, to be represented\r
16  * by Strings.\r
17  */\r
18 public class ModuleTestSampleData extends ListResourceBundle {\r
19     public Object[][] getContents() {\r
20     return contents;\r
21     }\r
22 \r
23     Object[][] contents = {\r
24     { "Info", new Object[][] {\r
25         { "Description", "This is a sample test module that illustrates ModuleTest " +\r
26           "and uses data formatted for ResourceModule." },\r
27         { "Headers", new String[] {\r
28         "aStringArray", "anIntArray", "aBooleanArray"\r
29         }},\r
30     }},\r
31     \r
32 \r
33     { "TestData", new Object[][] {\r
34         { "Test01", new Object[][] {\r
35         { "Info", new Object[][] {\r
36             { "Description", "A typical test using both settings and cases." },\r
37             { "Long_Description", "It does not defined its own headers, but instead " +\r
38               "uses the default headers defined for the module.  " +\r
39               "There are two sets of settings and three cases." },\r
40         }},\r
41         { "Settings", new Object[] {\r
42             new Object[][]\r
43             {{ "aString", "this is a string" },\r
44              { "anInt", "43" },\r
45              { "aBoolean", "false" }},\r
46             new Object[][] \r
47             {{ "aString", "this is another string" },\r
48              { "aBoolean", "true" }}\r
49         }},\r
50         { "Cases", new Object[] {\r
51             new Object[] {\r
52                 new String[] { "one", "two", "three" },\r
53                 new String[] { "24", "48", "72" },\r
54                 new String[] { "true", "false", "true" }\r
55             },\r
56             new Object[] { \r
57                 new String[] { "four", "five", "six" },\r
58                 new String[] { "-1", "-5", "-10" },\r
59                 new String[] { "true", "false", "false" }\r
60             },\r
61             new Object[] { \r
62                 new String[] { "bagel", "peanuts", "carrot" },\r
63                 new String[] { "0", "00001", "10101" },\r
64                 new String[] { "false", "false", "False" }\r
65             },\r
66         }}\r
67         }},\r
68 \r
69         { "Test02", new Object[][] {\r
70         { "Info", new Object[][] {\r
71             { "Description", "A typical test that uses cases but not settings." },\r
72             { "Long_Description", "It defines its own headers." },\r
73             { "Headers", new String[] {\r
74             "aString", "anInt", "aBoolean"\r
75             }},\r
76         }},\r
77         { "Cases", new Object[] {\r
78             new Object[] { "Superstring", "42", "true" },\r
79             new Object[] { "Underdog", "12", "false" },\r
80             new Object[] { "ScoobyDoo", "7", "TrUe" }\r
81         }}\r
82         }},\r
83 \r
84         { "Test03", new Object[][] {\r
85         { "Info", new Object[][] {\r
86             { "Description", "A typical test that uses just the info, no cases or settings." },\r
87             { "Extra", "This is some extra information." }\r
88         }},\r
89         }},\r
90 \r
91         // no Test04 data\r
92         // Test04 should cause an exception to be thrown since ModuleTestSample does not\r
93         // specify that it is ok for it to have no data.\r
94 \r
95         // no Test05 data\r
96         // Test05 should just log this fact, since ModuleTestSample indicates that it is\r
97         // ok for Test05 to have no data in its override of validateMethod.\r
98 \r
99         { "Test06", new Object[][] {\r
100         { "Info", new Object[][] {\r
101             { "Description", "A test that has bad data." },\r
102             { "Long_Description", "This illustrates how a data error will automatically " +\r
103               "terminate the settings and cases loop." },\r
104             { "Headers", new String[] {\r
105             "IsGood", "Data",\r
106             }},\r
107         }},\r
108         { "Cases", new Object[] {\r
109             new Object[] { "Good", "23" },\r
110             new Object[] { "Good", "-123" },\r
111             new Object[] { "Bad", "Whoops" },\r
112             new Object[] { "Not Executed", "35" },\r
113         }},\r
114         }},\r
115 \r
116         { "Test07", new Object[][] {\r
117         { "Info", new Object[][] {\r
118             { "Description", "A test that fails with a certain combination of settings and case." },\r
119             { "Long_Description", "This illustrates how a test error will automatically " +\r
120               "terminate the settings and cases loop.  Settings data is values, the case " +\r
121               "data is factors.  The third factor is not a factor of the second value.  " +\r
122               "The test will log an error, which will automatically stop the loop." },\r
123             { "Headers", new String[] {\r
124             "Factor",\r
125             }},\r
126         }},\r
127         { "Settings" , new Object[] {\r
128             new Object[][] {{ "Value", "210" }},\r
129             new Object[][] {{ "Value", "420" }},\r
130             new Object[][] {{ "Value", "42" }},\r
131             new Object[][] {{ "Value", "Not reached." }}\r
132         }},\r
133         { "Cases", new Object[] {\r
134             new Object[] { "2" },\r
135             new Object[] { "3" },\r
136             new Object[] { "5" },\r
137             new Object[] { "7" },\r
138         }},\r
139         }},\r
140 \r
141         { "Test08", new Object[][] {\r
142         { "Info", new Object[][] {\r
143             { "Description", "A test with data missing from a test case." },\r
144             { "Headers", new String[] {\r
145             "One", "Two", "Three"\r
146             }},\r
147         }},\r
148         { "Cases", new Object[] {\r
149             new Object[] { "1", "2", "3" },\r
150             new Object[] { "4", "5" }, // too short\r
151             new Object[] { "6", "7", "8" },\r
152         }},\r
153         }},\r
154 \r
155         { "Test09", new Object[][] {\r
156         { "Info", new Object[][] {\r
157             { "Description", "A test with data stored as int arrays instead of strings" },\r
158             { "Headers", new String[] {\r
159             "Radix", "Power", "Value"\r
160             }},\r
161         }},\r
162         { "Cases", new Object[] {\r
163             new Object[] { "2", new int[] { 1, 2, 3 }, new int[] { 2, 4, 8 }},\r
164             new Object[] { "3", new int[] { 3, 4, 5 }, new int[] { 27, 81, 243 }},\r
165             new Object[] { "2", new int[] { 0, 8, 16, 24 }, new int[] { 1, 256, 65536, 65536 * 256 }},\r
166         }},\r
167         }},\r
168     }},\r
169     };\r
170 }\r