Mercurial > hg > orthanc
comparison UnitTestsSources/UnitTestsMain.cpp @ 3217:cf8cbeb35f33
preliminary support of Korean character set
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 13 Feb 2019 17:46:12 +0100 |
parents | 810772486249 |
children | 9a83d94b2a1e |
comparison
equal
deleted
inserted
replaced
3216:c9a71eb4edcf | 3217:cf8cbeb35f33 |
---|---|
448 | 448 |
449 std::string s((char*) &data[0], 10); | 449 std::string s((char*) &data[0], 10); |
450 ASSERT_EQ("&abc", Toolbox::ConvertToAscii(s)); | 450 ASSERT_EQ("&abc", Toolbox::ConvertToAscii(s)); |
451 | 451 |
452 // Open in Emacs, then save with UTF-8 encoding, then "hexdump -C" | 452 // Open in Emacs, then save with UTF-8 encoding, then "hexdump -C" |
453 std::string utf8 = Toolbox::ConvertToUtf8(s, Encoding_Latin1); | 453 std::string utf8 = Toolbox::ConvertToUtf8(s, Encoding_Latin1, false); |
454 ASSERT_EQ(15u, utf8.size()); | 454 ASSERT_EQ(15u, utf8.size()); |
455 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[0])); | 455 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[0])); |
456 ASSERT_EQ(0xa0, static_cast<unsigned char>(utf8[1])); | 456 ASSERT_EQ(0xa0, static_cast<unsigned char>(utf8[1])); |
457 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[2])); | 457 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[2])); |
458 ASSERT_EQ(0xa9, static_cast<unsigned char>(utf8[3])); | 458 ASSERT_EQ(0xa9, static_cast<unsigned char>(utf8[3])); |
475 // This is a Latin-1 test string: "crane" with a circumflex accent | 475 // This is a Latin-1 test string: "crane" with a circumflex accent |
476 const unsigned char latin1[] = { 0x63, 0x72, 0xe2, 0x6e, 0x65 }; | 476 const unsigned char latin1[] = { 0x63, 0x72, 0xe2, 0x6e, 0x65 }; |
477 | 477 |
478 std::string s((char*) &latin1[0], sizeof(latin1) / sizeof(char)); | 478 std::string s((char*) &latin1[0], sizeof(latin1) / sizeof(char)); |
479 | 479 |
480 ASSERT_EQ(s, Toolbox::ConvertFromUtf8(Toolbox::ConvertToUtf8(s, Encoding_Latin1), Encoding_Latin1)); | 480 ASSERT_EQ(s, Toolbox::ConvertFromUtf8(Toolbox::ConvertToUtf8(s, Encoding_Latin1, false), Encoding_Latin1)); |
481 ASSERT_EQ("cre", Toolbox::ConvertToUtf8(s, Encoding_Utf8)); | 481 ASSERT_EQ("cre", Toolbox::ConvertToUtf8(s, Encoding_Utf8, false)); |
482 } | 482 } |
483 | 483 |
484 | 484 |
485 TEST(Toolbox, UrlDecode) | 485 TEST(Toolbox, UrlDecode) |
486 { | 486 { |
688 ASSERT_EQ(Encoding_Greek, StringToEncoding(EnumerationToString(Encoding_Greek))); | 688 ASSERT_EQ(Encoding_Greek, StringToEncoding(EnumerationToString(Encoding_Greek))); |
689 ASSERT_EQ(Encoding_Hebrew, StringToEncoding(EnumerationToString(Encoding_Hebrew))); | 689 ASSERT_EQ(Encoding_Hebrew, StringToEncoding(EnumerationToString(Encoding_Hebrew))); |
690 ASSERT_EQ(Encoding_Japanese, StringToEncoding(EnumerationToString(Encoding_Japanese))); | 690 ASSERT_EQ(Encoding_Japanese, StringToEncoding(EnumerationToString(Encoding_Japanese))); |
691 ASSERT_EQ(Encoding_Chinese, StringToEncoding(EnumerationToString(Encoding_Chinese))); | 691 ASSERT_EQ(Encoding_Chinese, StringToEncoding(EnumerationToString(Encoding_Chinese))); |
692 ASSERT_EQ(Encoding_Thai, StringToEncoding(EnumerationToString(Encoding_Thai))); | 692 ASSERT_EQ(Encoding_Thai, StringToEncoding(EnumerationToString(Encoding_Thai))); |
693 ASSERT_EQ(Encoding_Korean, StringToEncoding(EnumerationToString(Encoding_Korean))); | |
693 | 694 |
694 ASSERT_EQ(ResourceType_Patient, StringToResourceType(EnumerationToString(ResourceType_Patient))); | 695 ASSERT_EQ(ResourceType_Patient, StringToResourceType(EnumerationToString(ResourceType_Patient))); |
695 ASSERT_EQ(ResourceType_Study, StringToResourceType(EnumerationToString(ResourceType_Study))); | 696 ASSERT_EQ(ResourceType_Study, StringToResourceType(EnumerationToString(ResourceType_Study))); |
696 ASSERT_EQ(ResourceType_Series, StringToResourceType(EnumerationToString(ResourceType_Series))); | 697 ASSERT_EQ(ResourceType_Series, StringToResourceType(EnumerationToString(ResourceType_Series))); |
697 ASSERT_EQ(ResourceType_Instance, StringToResourceType(EnumerationToString(ResourceType_Instance))); | 698 ASSERT_EQ(ResourceType_Instance, StringToResourceType(EnumerationToString(ResourceType_Instance))); |