Search in sources :

Example 1 with TestData

use of android.icu.dev.test.TestDataModule.TestData in project j2objc by google.

the class DataDrivenFormatTest method formatTest.

/* (non-Javadoc)
     * @see android.icu.dev.test.ModuleTest#processModules()
     */
@Test
@Parameters(method = "getTestData")
public void formatTest(TestDataPair pair) {
    TestData td = pair.td;
    DataMap settings = pair.dm;
    String type = settings.getString("Type");
    if (type.equals("date_format")) {
        testConvertDate(td, settings, true);
    } else if (type.equals("date_parse")) {
        testConvertDate(td, settings, false);
    } else {
        errln("Unknown type: " + type);
    }
}
Also used : TestData(android.icu.dev.test.TestDataModule.TestData) DataMap(android.icu.dev.test.TestDataModule.DataMap) Parameters(junitparams.Parameters) Test(org.junit.Test) ModuleTest(android.icu.dev.test.ModuleTest)

Example 2 with TestData

use of android.icu.dev.test.TestDataModule.TestData in project j2objc by google.

the class ModuleTest method getTestData.

public static List<TestDataPair> getTestData(String moduleLocation, String moduleName) throws Exception {
    List<TestDataPair> list = new ArrayList<TestDataPair>();
    TestDataModule m = ModuleTest.loadTestData(moduleLocation, moduleName);
    Iterator<TestData> tIter = m.getTestDataIterator();
    while (tIter.hasNext()) {
        TestData t = tIter.next();
        for (Iterator siter = t.getSettingsIterator(); siter.hasNext(); ) {
            DataMap settings = (DataMap) siter.next();
            list.add(new TestDataPair(t, settings));
        }
    }
    return list;
}
Also used : TestData(android.icu.dev.test.TestDataModule.TestData) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) DataMap(android.icu.dev.test.TestDataModule.DataMap)

Example 3 with TestData

use of android.icu.dev.test.TestDataModule.TestData in project j2objc by google.

the class DataDrivenCalendarTest method calendarTest.

/* (non-Javadoc)
     * @see android.icu.dev.test.ModuleTest#processModules()
     */
@Test
@Parameters(method = "getTestData")
public void calendarTest(TestDataPair pair) {
    TestData td = pair.td;
    DataMap settings = pair.dm;
    String type = settings.getString("Type");
    if (type.equals("convert_fwd")) {
        testConvert(td, settings, true);
    } else if (type.equals("convert_rev")) {
        testConvert(td, settings, false);
    } else if (type.equals("ops")) {
        testOps(td, settings);
    } else {
        errln("Unknown type: " + type);
    }
}
Also used : TestData(android.icu.dev.test.TestDataModule.TestData) DataMap(android.icu.dev.test.TestDataModule.DataMap) Parameters(junitparams.Parameters) Test(org.junit.Test) ModuleTest(android.icu.dev.test.ModuleTest)

Aggregations

DataMap (android.icu.dev.test.TestDataModule.DataMap)3 TestData (android.icu.dev.test.TestDataModule.TestData)3 ModuleTest (android.icu.dev.test.ModuleTest)2 Parameters (junitparams.Parameters)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1