15 #define BOOST_TEST_DYN_LINK
16 #define BOOST_TEST_MAIN
17 #define BOOST_TEST_MODULE UnicodeTestSuite
18 #include <boost/test/unit_test.hpp>
22 namespace boost_utf = boost::unit_test;
34 boost_utf::unit_test_log.set_format (boost_utf::XML);
35 boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
51 BOOST_AUTO_TEST_SUITE (master_test_suite)
59 std::string lLogFilename (
"UnicodeTestSuite.log");
62 std::ofstream logOutputFile;
64 logOutputFile.open (lLogFilename.c_str());
65 logOutputFile.clear();
71 const std::string lFRStr =
"À côté de Nice Côte d'Azur";
72 const std::string lFRTranslitStr = lTransliterator.
normalise (lFRStr);
73 const std::string lFRTargetStr =
"a cote de nice cote d azur";
74 const std::string lHUStr =
"San Franciscó-i nemzetközi repülőtér";
75 const std::string lHUTranslitStr = lTransliterator.
normalise (lHUStr);
76 const std::string lHUTargetStr =
"san francisco i nemzetkozi repuloter";
77 const std::string lGRStr =
"Αλφαβητικός Κατάλογος";
78 const std::string lGRTranslitStr = lTransliterator.
normalise (lGRStr);
79 const std::string lGRTargetStr =
"alphabetikos katalogos";
80 const std::string lRUStr =
"Аэропорт «Аннаба», Биологическом";
81 const std::string lRUTranslitStr = lTransliterator.
normalise (lRUStr);
82 const std::string lRUTargetStr =
"aeroport annaba biologiceskom";
83 const std::string lUKStr =
"Биологїческом";
84 const std::string lUKTranslitStr = lTransliterator.
normalise (lUKStr);
85 const std::string lUKTargetStr =
"biologiceskom";
86 const std::string lTRStr =
"San Francisco Uluslararası Havalimanı";
87 const std::string lTRTranslitStr = lTransliterator.
normalise (lTRStr);
88 const std::string lTRTargetStr =
"san francisco uluslararası havalimanı";
91 const std::string lARStr =
"مطار سان فرانسيسكو الدولي";
92 const std::string lARTranslitStr = lTransliterator.
normalise (lARStr);
93 const std::string lARTargetStr =
"mtar san fransyskw aldwly";
94 const std::string lFAStr =
"فرودگاه بین المللی سانفرانسیسکو";
95 const std::string lFATranslitStr = lTransliterator.
normalise (lFAStr);
96 const std::string lFATargetStr =
"frwdgah byn almlly sanfransyskw";
99 const std::string lZHStr =
"舊金山國際機場";
100 const std::string lZHTranslitStr = lTransliterator.
normalise (lZHStr);
101 const std::string lZHTargetStr =
"jiu jin shan guo ji ji chang";
102 const std::string lJPStr =
"サンフランシスコ国際空港";
103 const std::string lJPTranslitStr = lTransliterator.
normalise (lJPStr);
104 const std::string lJPTargetStr =
"sanfuranshisuko guo ji kong gang";
105 const std::string lKOStr =
"샌프란시스코 국제공항";
106 const std::string lKOTranslitStr = lTransliterator.
normalise (lKOStr);
107 const std::string lKOTargetStr =
"saenpeulansiseuko gugjegonghang";
108 const std::string lTHStr =
"ท่าอากาศยานนานาชาติซานฟรานซิสโก";
109 const std::string lTHTranslitStr = lTransliterator.
normalise (lTHStr);
110 const std::string lTHTargetStr =
"tha xakasyan nana chat san f ran ss ko";
111 const std::string lVIStr =
"Sân bay quốc tế San Francisco";
112 const std::string lVITranslitStr = lTransliterator.
normalise (lVIStr);
113 const std::string lVITargetStr =
"san bay quoc te san francisco";
116 logOutputFile <<
"[FR] " << lFRStr <<
" -> " << lFRTranslitStr << std::endl;
117 BOOST_CHECK_MESSAGE (lFRTranslitStr == lFRTargetStr,
118 "The French transliterated string for '" << lFRStr
119 <<
"' should be '" << lFRTargetStr <<
"'. "
120 <<
"However, it is '" << lFRTranslitStr <<
"'.");
123 logOutputFile <<
"[HU] " << lHUStr <<
" -> " << lHUTranslitStr << std::endl;
124 BOOST_CHECK_MESSAGE (lHUTranslitStr == lHUTargetStr,
125 "The Hungarian transliterated string for '" << lHUStr
126 <<
"' should be '" << lHUTargetStr <<
"'. "
127 <<
"However, it is '" << lHUTranslitStr <<
"'.");
130 logOutputFile <<
"[GR] " << lGRStr <<
" -> " << lGRTranslitStr << std::endl;
131 BOOST_CHECK_MESSAGE (lGRTranslitStr == lGRTargetStr,
132 "The Greek transliterated string for '" << lGRStr
133 <<
"' should be '" << lGRTargetStr <<
"'. "
134 <<
"However, it is '" << lGRTranslitStr <<
"'.");
137 logOutputFile <<
"[RU] " << lRUStr <<
" -> " << lRUTranslitStr << std::endl;
138 BOOST_CHECK_MESSAGE (lRUTranslitStr == lRUTargetStr,
139 "The Russian transliterated string for '" << lRUStr
140 <<
"' should be '" << lRUTargetStr <<
"'. "
141 <<
"However, it is '" << lRUTranslitStr <<
"'.");
144 logOutputFile <<
"[UK] " << lUKStr <<
" -> " << lUKTranslitStr << std::endl;
145 BOOST_CHECK_MESSAGE (lUKTranslitStr == lUKTargetStr,
146 "The Ukrainian transliterated string for '" << lUKStr
147 <<
"' should be '" << lUKTargetStr <<
"'. "
148 <<
"However, it is '" << lUKTranslitStr <<
"'.");
151 logOutputFile <<
"[TR] " << lTRStr <<
" -> " << lTRTranslitStr << std::endl;
152 BOOST_CHECK_MESSAGE (lTRTranslitStr == lTRTargetStr,
153 "The Turkish transliterated string for '" << lTRStr
154 <<
"' should be '" << lTRTargetStr <<
"'. "
155 <<
"However, it is '" << lTRTranslitStr <<
"'.");
158 logOutputFile <<
"[AR] " << lARStr <<
" -> " << lARTranslitStr << std::endl;
159 BOOST_CHECK_MESSAGE (lARTranslitStr == lARTargetStr,
160 "The Arabic transliterated string for '" << lARStr
161 <<
"' should be '" << lARTargetStr <<
"'. "
162 <<
"However, it is '" << lARTranslitStr <<
"'.");
165 logOutputFile <<
"[FA] " << lFAStr <<
" -> " << lFATranslitStr << std::endl;
166 BOOST_CHECK_MESSAGE (lFATranslitStr == lFATargetStr,
167 "The Arabic transliterated string for '" << lFAStr
168 <<
"' should be '" << lFATargetStr <<
"'. "
169 <<
"However, it is '" << lFATranslitStr <<
"'.");
172 logOutputFile <<
"[ZH] " << lZHStr <<
" -> " << lZHTranslitStr << std::endl;
173 BOOST_CHECK_MESSAGE (lZHTranslitStr == lZHTargetStr,
174 "The Chinese transliterated string for '" << lZHStr
175 <<
"' should be '" << lZHTargetStr <<
"'. "
176 <<
"However, it is '" << lZHTranslitStr <<
"'.");
179 logOutputFile <<
"[JP] " << lJPStr <<
" -> " << lJPTranslitStr << std::endl;
180 BOOST_CHECK_MESSAGE (lJPTranslitStr == lJPTargetStr,
181 "The Japanese transliterated string for '" << lJPStr
182 <<
"' should be '" << lJPTargetStr <<
"'. "
183 <<
"However, it is '" << lJPTranslitStr <<
"'.");
186 logOutputFile <<
"[KO] " << lKOStr <<
" -> " << lKOTranslitStr << std::endl;
187 BOOST_CHECK_MESSAGE (lKOTranslitStr == lKOTargetStr,
188 "The Korean transliterated string for '" << lKOStr
189 <<
"' should be '" << lKOTargetStr <<
"'. "
190 <<
"However, it is '" << lKOTranslitStr <<
"'.");
193 logOutputFile <<
"[TH] " << lTHStr <<
" -> " << lTHTranslitStr << std::endl;
194 BOOST_CHECK_MESSAGE (lTHTranslitStr == lTHTargetStr,
195 "The Korean transliterated string for '" << lTHStr
196 <<
"' should be '" << lTHTargetStr <<
"'. "
197 <<
"However, it is '" << lTHTranslitStr <<
"'.");
200 logOutputFile <<
"[VI] " << lVIStr <<
" -> " << lVITranslitStr << std::endl;
201 BOOST_CHECK_MESSAGE (lVITranslitStr == lVITargetStr,
202 "The Korean transliterated string for '" << lVIStr
203 <<
"' should be '" << lVITargetStr <<
"'. "
204 <<
"However, it is '" << lVITranslitStr <<
"'.");
208 logOutputFile.close();
212 BOOST_AUTO_TEST_SUITE_END()
std::ofstream utfReportStream("UnicodeTestSuite_utfresults.xml")
BOOST_AUTO_TEST_CASE(unicode_strings)
BOOST_GLOBAL_FIXTURE(UnitTestConfig)
std::string normalise(const std::string &iString) const