MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / testCharsetDetection

Function testCharsetDetection

unittest/unittest.cpp:232–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232static void testCharsetDetection(String * path)
233{
234 printf("testCharsetDetection\n");
235 String * inputPath = path->stringByAppendingPathComponent(MCSTR("input"));
236 Array * list = pathsInDirectory(inputPath);
237 int failure = 0;
238 int success = 0;
239 mc_foreacharray(String, filename, list) {
240 Data * data = Data::dataWithContentsOfFile(filename);
241 String * charset = data->charsetWithFilteredHTML(false);
242 charset = charset->lowercaseString();
243 if (!filename->lastPathComponent()->stringByDeletingPathExtension()->isEqual(charset)) {
244 failure ++;
245 fprintf(stderr, "testCharsetDetection: failed for %s\n", MCUTF8(filename));
246 fprintf(stderr, "got: %s\n", MCUTF8(charset));
247 }
248 else {
249 success ++;
250 }
251 }
252 if (failure > 0) {
253 printf("testCharsetDetection ok: %i succeeded, %i failed\n", success, failure);
254 global_failure ++;
255 return;
256 }
257 printf("testCharsetDetection ok: %i succeeded\n", success);
258 global_success ++;
259}
260
261static String * tweakDateFromSummary(String * summary) {
262 Array * components = summary->componentsSeparatedByString(MCSTR("\n"));

Callers 1

mainFunction · 0.85

Calls 2

pathsInDirectoryFunction · 0.85

Tested by

no test coverage detected