001: /**
002: *******************************************************************************
003: * Copyright (C) 2001-2004, International Business Machines Corporation and *
004: * others. All Rights Reserved. *
005: *******************************************************************************
006: */package com.ibm.icu.dev.test.sample;
007:
008: import java.util.ListResourceBundle;
009:
010: /**
011: * This is sample data for ModuleTestSample, which is an illustration
012: * of a subclass of ModuleTest. This data is in a format which
013: * is understood by ResourceModule, which for simplicity expects
014: * all data, including numeric and boolean data, to be represented
015: * by Strings.
016: */
017: public class ModuleTestSampleData extends ListResourceBundle {
018: public Object[][] getContents() {
019: return contents;
020: }
021:
022: Object[][] contents = {
023: {
024: "Info",
025: new Object[][] {
026: {
027: "Description",
028: "This is a sample test module that illustrates ModuleTest "
029: + "and uses data formatted for ResourceModule." },
030: {
031: "Headers",
032: new String[] { "aStringArray",
033: "anIntArray",
034: "aBooleanArray" } }, } },
035:
036: {
037: "TestData",
038: new Object[][] {
039: {
040: "Test01",
041: new Object[][] {
042: {
043: "Info",
044: new Object[][] {
045: {
046: "Description",
047: "A typical test using both settings and cases." },
048: {
049: "Long_Description",
050: "It does not defined its own headers, but instead "
051: + "uses the default headers defined for the module. "
052: + "There are two sets of settings and three cases." }, } },
053: {
054: "Settings",
055: new Object[] {
056: new Object[][] {
057: {
058: "aString",
059: "this is a string" },
060: {
061: "anInt",
062: "43" },
063: {
064: "aBoolean",
065: "false" } },
066: new Object[][] {
067: {
068: "aString",
069: "this is another string" },
070: {
071: "aBoolean",
072: "true" } } } },
073: {
074: "Cases",
075: new Object[] {
076: new Object[] {
077: new String[] {
078: "one",
079: "two",
080: "three" },
081: new String[] {
082: "24",
083: "48",
084: "72" },
085: new String[] {
086: "true",
087: "false",
088: "true" } },
089: new Object[] {
090: new String[] {
091: "four",
092: "five",
093: "six" },
094: new String[] {
095: "-1",
096: "-5",
097: "-10" },
098: new String[] {
099: "true",
100: "false",
101: "false" } },
102: new Object[] {
103: new String[] {
104: "bagel",
105: "peanuts",
106: "carrot" },
107: new String[] {
108: "0",
109: "00001",
110: "10101" },
111: new String[] {
112: "false",
113: "false",
114: "False" } }, } } } },
115:
116: {
117: "Test02",
118: new Object[][] {
119: {
120: "Info",
121: new Object[][] {
122: {
123: "Description",
124: "A typical test that uses cases but not settings." },
125: {
126: "Long_Description",
127: "It defines its own headers." },
128: {
129: "Headers",
130: new String[] {
131: "aString",
132: "anInt",
133: "aBoolean" } }, } },
134: {
135: "Cases",
136: new Object[] {
137: new Object[] {
138: "Superstring",
139: "42",
140: "true" },
141: new Object[] {
142: "Underdog",
143: "12",
144: "false" },
145: new Object[] {
146: "ScoobyDoo",
147: "7",
148: "TrUe" } } } } },
149:
150: {
151: "Test03",
152: new Object[][] { {
153: "Info",
154: new Object[][] {
155: { "Description",
156: "A typical test that uses just the info, no cases or settings." },
157: { "Extra",
158: "This is some extra information." } } }, } },
159:
160: // no Test04 data
161: // Test04 should cause an exception to be thrown since ModuleTestSample does not
162: // specify that it is ok for it to have no data.
163:
164: // no Test05 data
165: // Test05 should just log this fact, since ModuleTestSample indicates that it is
166: // ok for Test05 to have no data in its override of validateMethod.
167:
168: {
169: "Test06",
170: new Object[][] {
171: {
172: "Info",
173: new Object[][] {
174: {
175: "Description",
176: "A test that has bad data." },
177: {
178: "Long_Description",
179: "This illustrates how a data error will automatically "
180: + "terminate the settings and cases loop." },
181: {
182: "Headers",
183: new String[] {
184: "IsGood",
185: "Data", } }, } },
186: {
187: "Cases",
188: new Object[] {
189: new Object[] {
190: "Good",
191: "23" },
192: new Object[] {
193: "Good",
194: "-123" },
195: new Object[] {
196: "Bad",
197: "Whoops" },
198: new Object[] {
199: "Not Executed",
200: "35" }, } }, } },
201:
202: {
203: "Test07",
204: new Object[][] {
205: {
206: "Info",
207: new Object[][] {
208: {
209: "Description",
210: "A test that fails with a certain combination of settings and case." },
211: {
212: "Long_Description",
213: "This illustrates how a test error will automatically "
214: + "terminate the settings and cases loop. Settings data is values, the case "
215: + "data is factors. The third factor is not a factor of the second value. "
216: + "The test will log an error, which will automatically stop the loop." },
217: {
218: "Headers",
219: new String[] { "Factor", } }, } },
220: {
221: "Settings",
222: new Object[] {
223: new Object[][] { {
224: "Value",
225: "210" } },
226: new Object[][] { {
227: "Value",
228: "420" } },
229: new Object[][] { {
230: "Value",
231: "42" } },
232: new Object[][] { {
233: "Value",
234: "Not reached." } } } },
235: {
236: "Cases",
237: new Object[] {
238: new Object[] { "2" },
239: new Object[] { "3" },
240: new Object[] { "5" },
241: new Object[] { "7" }, } }, } },
242:
243: {
244: "Test08",
245: new Object[][] {
246: {
247: "Info",
248: new Object[][] {
249: {
250: "Description",
251: "A test with data missing from a test case." },
252: {
253: "Headers",
254: new String[] {
255: "One",
256: "Two",
257: "Three" } }, } },
258: {
259: "Cases",
260: new Object[] {
261: new Object[] {
262: "1",
263: "2",
264: "3" },
265: new Object[] {
266: "4",
267: "5" }, // too short
268: new Object[] {
269: "6",
270: "7",
271: "8" }, } }, } },
272:
273: {
274: "Test09",
275: new Object[][] {
276: {
277: "Info",
278: new Object[][] {
279: {
280: "Description",
281: "A test with data stored as int arrays instead of strings" },
282: {
283: "Headers",
284: new String[] {
285: "Radix",
286: "Power",
287: "Value" } }, } },
288: {
289: "Cases",
290: new Object[] {
291: new Object[] {
292: "2",
293: new int[] {
294: 1,
295: 2,
296: 3 },
297: new int[] {
298: 2,
299: 4,
300: 8 } },
301: new Object[] {
302: "3",
303: new int[] {
304: 3,
305: 4,
306: 5 },
307: new int[] {
308: 27,
309: 81,
310: 243 } },
311: new Object[] {
312: "2",
313: new int[] {
314: 0,
315: 8,
316: 16,
317: 24 },
318: new int[] {
319: 1,
320: 256,
321: 65536,
322: 65536 * 256 } }, } }, } }, } }, };
323: }
|