Mercurial > hg > orthanc
comparison UnitTestsSources/StreamTests.cpp @ 1972:38fb3f524d81
fix warnings
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 11 Apr 2016 14:02:18 +0200 |
parents | b1291df2f780 |
children | aa4b8895cd23 |
comparison
equal
deleted
inserted
replaced
1971:869a87c08673 | 1972:38fb3f524d81 |
---|---|
72 c.SetPrefixWithUncompressedSize(false); | 72 c.SetPrefixWithUncompressedSize(false); |
73 IBufferCompressor::Compress(compressed, c, s); | 73 IBufferCompressor::Compress(compressed, c, s); |
74 | 74 |
75 std::string uncompressed; | 75 std::string uncompressed; |
76 IBufferCompressor::Uncompress(uncompressed, c, compressed); | 76 IBufferCompressor::Uncompress(uncompressed, c, compressed); |
77 ASSERT_EQ(0, uncompressed.size()); | 77 ASSERT_TRUE(uncompressed.empty()); |
78 } | 78 } |
79 | 79 |
80 | 80 |
81 TEST(Gzip, BasicWithPrefix) | 81 TEST(Gzip, BasicWithPrefix) |
82 { | 82 { |
105 ASSERT_TRUE(c.HasPrefixWithUncompressedSize()); | 105 ASSERT_TRUE(c.HasPrefixWithUncompressedSize()); |
106 IBufferCompressor::Compress(compressed, c, s); | 106 IBufferCompressor::Compress(compressed, c, s); |
107 | 107 |
108 std::string uncompressed; | 108 std::string uncompressed; |
109 IBufferCompressor::Uncompress(uncompressed, c, compressed); | 109 IBufferCompressor::Uncompress(uncompressed, c, compressed); |
110 ASSERT_EQ(0, uncompressed.size()); | 110 ASSERT_TRUE(uncompressed.empty()); |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 TEST(Zlib, Basic) | 114 TEST(Zlib, Basic) |
115 { | 115 { |
152 | 152 |
153 std::string compressed; | 153 std::string compressed; |
154 ZlibCompressor c; | 154 ZlibCompressor c; |
155 IBufferCompressor::Compress(compressed, c, s); | 155 IBufferCompressor::Compress(compressed, c, s); |
156 | 156 |
157 ASSERT_FALSE(compressed.empty()); | |
157 compressed[compressed.size() - 1] = 'a'; | 158 compressed[compressed.size() - 1] = 'a'; |
158 std::string u; | 159 std::string u; |
159 | 160 |
160 ASSERT_THROW(IBufferCompressor::Uncompress(u, c, compressed), OrthancException); | 161 ASSERT_THROW(IBufferCompressor::Uncompress(u, c, compressed), OrthancException); |
161 } | 162 } |
170 IBufferCompressor::Compress(compressed, c, s); | 171 IBufferCompressor::Compress(compressed, c, s); |
171 ASSERT_EQ(compressed, compressed2); | 172 ASSERT_EQ(compressed, compressed2); |
172 | 173 |
173 std::string uncompressed; | 174 std::string uncompressed; |
174 IBufferCompressor::Uncompress(uncompressed, c, compressed); | 175 IBufferCompressor::Uncompress(uncompressed, c, compressed); |
175 ASSERT_EQ(0u, uncompressed.size()); | 176 ASSERT_TRUE(uncompressed.empty()); |
176 } | 177 } |
177 | 178 |
178 | 179 |
179 static bool ReadAllStream(std::string& result, | 180 static bool ReadAllStream(std::string& result, |
180 IHttpStreamAnswer& stream, | 181 IHttpStreamAnswer& stream, |