Mercurial > hg > orthanc
diff UnitTestsSources/UnitTestsMain.cpp @ 3357:c0aa5f1cf2f5
new class: FileBuffer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 02 May 2019 09:22:36 +0200 |
parents | b21d4cc8e5d1 |
children | c08bb6ac3b7f |
line wrap: on
line diff
--- a/UnitTestsSources/UnitTestsMain.cpp Mon Apr 29 17:24:30 2019 +0200 +++ b/UnitTestsSources/UnitTestsMain.cpp Thu May 02 09:22:36 2019 +0200 @@ -39,6 +39,7 @@ #include <ctype.h> #include "../Core/DicomFormat/DicomTag.h" +#include "../Core/FileBuffer.h" #include "../Core/HttpServer/HttpToolbox.h" #include "../Core/Logging.h" #include "../Core/MetricsRegistry.h" @@ -679,6 +680,21 @@ } +TEST(Toolbox, FileBuffer) +{ + FileBuffer f; + f.Append("a", 1); + f.Append("", 0); + f.Append("bc", 2); + + std::string s; + f.Read(s); + ASSERT_EQ("abc", s); + + ASSERT_THROW(f.Append("d", 1), OrthancException); // File is closed +} + + TEST(Toolbox, Wildcard) { ASSERT_EQ("abcd", Toolbox::WildcardToRegularExpression("abcd"));