blob: 5a2b0f423214c8f85b604b72bfdd07190b7be205 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001#include "merge_res_and_xliff.h"
2
3
4int
5merge_test()
6{
7 Configuration english;
8 english.locale = "en_US";
9 Configuration translated;
10 translated.locale = "zz_ZZ";
11
12 ValuesFile* en_current = ValuesFile::ParseFile("testdata/merge_en_current.xml", english,
13 CURRENT_VERSION, "3");
14 if (en_current == NULL) {
15 fprintf(stderr, "merge_test: unable to read testdata/merge_en_current.xml\n");
16 return 1;
17 }
18
19 ValuesFile* xx_current = ValuesFile::ParseFile("testdata/merge_xx_current.xml", translated,
20 CURRENT_VERSION, "3");
21 if (xx_current == NULL) {
22 fprintf(stderr, "merge_test: unable to read testdata/merge_xx_current.xml\n");
23 return 1;
24 }
25 ValuesFile* xx_old = ValuesFile::ParseFile("testdata/merge_xx_old.xml", translated,
26 OLD_VERSION, "2");
27 if (xx_old == NULL) {
28 fprintf(stderr, "merge_test: unable to read testdata/merge_xx_old.xml\n");
29 return 1;
30 }
31
32 XLIFFFile* xliff = XLIFFFile::Parse("testdata/merge.xliff");
33
34 ValuesFile* result = merge_res_and_xliff(en_current, xx_current, xx_old,
35 "//device/tools/localize/testdata/res/values/strings.xml", xliff);
36
37 if (result == NULL) {
38 fprintf(stderr, "merge_test: result is NULL\n");
39 return 1;
40 }
41
42 printf("======= RESULT =======\n%s===============\n", result->ToString().c_str());
43
44 return 0;
45}
46
47