Mercurial > hg > orthanc
comparison UnitTestsSources/UnitTestsMain.cpp @ 2442:330349d712f9
fix Toolbox::IsAsciiString
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Dec 2017 21:58:09 +0100 |
parents | 82d5e305fbd9 |
children | 878b59270859 |
comparison
equal
deleted
inserted
replaced
2441:67c01a6f151e | 2442:330349d712f9 |
---|---|
459 Toolbox::UrlDecode(s); | 459 Toolbox::UrlDecode(s); |
460 ASSERT_EQ("(2000,00A4) Other", s); | 460 ASSERT_EQ("(2000,00A4) Other", s); |
461 } | 461 } |
462 | 462 |
463 | 463 |
464 TEST(Toolbox, IsAsciiString) | |
465 { | |
466 std::string s = "Hello 12 /"; | |
467 ASSERT_EQ(10u, s.size()); | |
468 ASSERT_TRUE(Toolbox::IsAsciiString(s)); | |
469 ASSERT_TRUE(Toolbox::IsAsciiString(s.c_str(), 10)); | |
470 ASSERT_FALSE(Toolbox::IsAsciiString(s.c_str(), 11)); // Taking the trailing hidden '\0' | |
471 | |
472 s[2] = '\0'; | |
473 ASSERT_EQ(10u, s.size()); | |
474 ASSERT_FALSE(Toolbox::IsAsciiString(s)); | |
475 } | |
476 | |
477 | |
464 #if defined(__linux__) | 478 #if defined(__linux__) |
465 TEST(OrthancInitialization, AbsoluteDirectory) | 479 TEST(OrthancInitialization, AbsoluteDirectory) |
466 { | 480 { |
467 ASSERT_EQ("/tmp/hello", Configuration::InterpretRelativePath("/tmp", "hello")); | 481 ASSERT_EQ("/tmp/hello", Configuration::InterpretRelativePath("/tmp", "hello")); |
468 ASSERT_EQ("/tmp", Configuration::InterpretRelativePath("/tmp", "/tmp")); | 482 ASSERT_EQ("/tmp", Configuration::InterpretRelativePath("/tmp", "/tmp")); |