-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test data generator for date time formatting
- Loading branch information
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDateTimeTestData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package org.unicode.cldr.tool; | ||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import org.pcollections.HashPMap; | ||
import org.pcollections.HashTreePMap; | ||
import org.pcollections.PMap; | ||
import org.pcollections.PVector; | ||
import org.pcollections.TreePVector; | ||
import org.unicode.cldr.util.CLDRPaths; | ||
import org.unicode.cldr.util.TempPrintWriter; | ||
|
||
public class GenerateDateTimeTestData { | ||
|
||
private static final String OUTPUT_SUBDIR = "datetime"; | ||
|
||
private static final String OUTPUT_FILENAME = "datetime.txt"; | ||
|
||
private static final PVector<String> NUMBERING_SYSTEMS = | ||
TreePVector.from(Arrays.asList("latn", "arab", "beng")); | ||
|
||
private static final PVector<String> LOCALES = | ||
TreePVector.from(Arrays.asList("en-US", "en-GB", | ||
"zh-TW", "vi", "ar", "mt-MT", | ||
"bn", "zu", | ||
"und")); | ||
|
||
private static final HashPMap<String,Object> emptyMapStringToObject = HashTreePMap.empty(); | ||
|
||
private static final PVector<PMap<String, Object>> SPEC_OPTIONS = | ||
TreePVector.from(Arrays.asList( | ||
emptyMapStringToObject.plus("dateStyle", "short").plus("timeStyle", "short"), | ||
emptyMapStringToObject.plus("dateStyle", "medium").plus("timeStyle", "medium"), | ||
emptyMapStringToObject.plus("dateStyle", "long").plus("timeStyle", "long"), | ||
emptyMapStringToObject.plus("dateStyle", "full").plus("timeStyle", "full"), | ||
emptyMapStringToObject.plus("dateStyle", "full").plus("timeStyle", "short"), | ||
emptyMapStringToObject.plus("dateStyle", "long"), | ||
emptyMapStringToObject.plus("timeStyle", "long"), | ||
emptyMapStringToObject.plus("hour", "numeric"), | ||
emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric"), | ||
emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") | ||
.plus("second", "numeric"), | ||
emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") | ||
.plus("second", "numeric").plus("fractionalSecondDigits", 1), | ||
emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") | ||
.plus("second", "numeric").plus("fractionalSecondDigits", 2), | ||
emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") | ||
.plus("second", "numeric").plus("fractionalSecondDigits", 3), | ||
emptyMapStringToObject.plus("hour", "numeric").plus("minute", "numeric") | ||
.plus("second", "numeric"), | ||
emptyMapStringToObject.plus("month", "numeric").plus("weekday", "long") | ||
.plus("day", "numeric"), | ||
emptyMapStringToObject.plus("month", "2-digit").plus("weekday", "long") | ||
.plus("day", "numeric"), | ||
emptyMapStringToObject.plus("month", "long").plus("weekday", "long").plus("day", "numeric"), | ||
emptyMapStringToObject.plus("month", "short").plus("weekday", "long") | ||
.plus("day", "numeric"), | ||
emptyMapStringToObject.plus("month", "narrow").plus("weekday", "long") | ||
.plus("day", "numeric"), | ||
emptyMapStringToObject.plus("month", "short").plus("weekday", "short") | ||
.plus("day", "numeric"), | ||
emptyMapStringToObject.plus("month", "short").plus("weekday", "narrow") | ||
.plus("day", "numeric"), | ||
emptyMapStringToObject.plus("era", "long"), | ||
emptyMapStringToObject.plus("era", "short"), | ||
emptyMapStringToObject.plus("era", "narrow"), | ||
emptyMapStringToObject.plus("timeZoneName", "long"), | ||
emptyMapStringToObject.plus("timeZoneName", "short"), | ||
emptyMapStringToObject.plus("timeZoneName", "shortOffset"), | ||
emptyMapStringToObject.plus("timeZoneName", "longOffset"), | ||
emptyMapStringToObject.plus("timeZoneName", "shortGeneric"), | ||
emptyMapStringToObject.plus("timeZoneName", "longGeneric") | ||
)); | ||
|
||
private static final PVector<String> CALENDARS = | ||
TreePVector.from(Arrays.asList( | ||
"gregory", | ||
"buddhist", "hebrew", "chinese", "roc", "japanese", | ||
"islamic", "islamic-umalqura", "persian" | ||
)); | ||
|
||
private static final PVector<String> TIME_ZONES = | ||
TreePVector.from(Arrays.asList( | ||
"America/Los_Angeles", | ||
"Africa/Luanda", | ||
"Asia/Tehran", | ||
"Europe/Kiev", | ||
"Australia/Brisbane", | ||
"Pacific/Palau", | ||
"America/Montevideo" | ||
)); | ||
|
||
|
||
public static void main(String[] args) throws IOException { | ||
try (TempPrintWriter pw = | ||
TempPrintWriter.openUTF8Writer( | ||
CLDRPaths.TEST_DATA + OUTPUT_SUBDIR, OUTPUT_FILENAME)) { | ||
|
||
|
||
|
||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters