Electroneum
encodedstreamtest.cpp File Reference
Include dependency graph for encodedstreamtest.cpp:

Go to the source code of this file.

Classes

class  EncodedStreamTest
 

Functions

 TEST_F (EncodedStreamTest, EncodedInputStream)
 
 TEST_F (EncodedStreamTest, AutoUTFInputStream)
 
 TEST_F (EncodedStreamTest, EncodedOutputStream)
 
 TEST_F (EncodedStreamTest, AutoUTFOutputStream)
 

Function Documentation

◆ TEST_F() [1/4]

Definition at line 254 of file encodedstreamtest.cpp.

254  {
255  TestEncodedInputStream<UTF8<>, UTF8<> >("utf8.json");
256  TestEncodedInputStream<UTF8<>, UTF8<> >("utf8bom.json");
257  TestEncodedInputStream<UTF16LE<>, UTF16<> >("utf16le.json");
258  TestEncodedInputStream<UTF16LE<>, UTF16<> >("utf16lebom.json");
259  TestEncodedInputStream<UTF16BE<>, UTF16<> >("utf16be.json");
260  TestEncodedInputStream<UTF16BE<>, UTF16<> >("utf16bebom.json");
261  TestEncodedInputStream<UTF32LE<>, UTF32<> >("utf32le.json");
262  TestEncodedInputStream<UTF32LE<>, UTF32<> >("utf32lebom.json");
263  TestEncodedInputStream<UTF32BE<>, UTF32<> >("utf32be.json");
264  TestEncodedInputStream<UTF32BE<>, UTF32<> >("utf32bebom.json");
265 }
UTF-32 encoding.
Definition: encodings.h:418
UTF-16 encoding.
Definition: encodings.h:269
UTF-8 encoding.
Definition: encodings.h:96

◆ TEST_F() [2/4]

Definition at line 267 of file encodedstreamtest.cpp.

267  {
268  TestAutoUTFInputStream("utf8.json", false);
269  TestAutoUTFInputStream("utf8bom.json", true);
270  TestAutoUTFInputStream("utf16le.json", false);
271  TestAutoUTFInputStream("utf16lebom.json",true);
272  TestAutoUTFInputStream("utf16be.json", false);
273  TestAutoUTFInputStream("utf16bebom.json",true);
274  TestAutoUTFInputStream("utf32le.json", false);
275  TestAutoUTFInputStream("utf32lebom.json",true);
276  TestAutoUTFInputStream("utf32be.json", false);
277  TestAutoUTFInputStream("utf32bebom.json", true);
278 
279  {
280  // Auto detection fail, use user defined UTF type
281  const char json[] = "{ }";
282  MemoryStream ms(json, sizeof(json));
284  EXPECT_FALSE(eis.HasBOM());
285  EXPECT_EQ(kUTF8, eis.GetType());
286  }
287 }
Input stream wrapper with dynamically bound encoding and automatic encoding detection.
UTF-8.
Definition: encodings.h:604
Represents an in-memory input byte stream.
Definition: memorystream.h:40
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
rapidjson::Document json
Definition: transport.cpp:49
Here is the call graph for this function:

◆ TEST_F() [3/4]

Definition at line 289 of file encodedstreamtest.cpp.

289  {
290  TestEncodedOutputStream<UTF8<>, UTF8<> >("utf8.json", false);
291  TestEncodedOutputStream<UTF8<>, UTF8<> >("utf8bom.json", true);
292  TestEncodedOutputStream<UTF16LE<>, UTF16<> >("utf16le.json", false);
293  TestEncodedOutputStream<UTF16LE<>, UTF16<> >("utf16lebom.json",true);
294  TestEncodedOutputStream<UTF16BE<>, UTF16<> >("utf16be.json", false);
295  TestEncodedOutputStream<UTF16BE<>, UTF16<> >("utf16bebom.json",true);
296  TestEncodedOutputStream<UTF32LE<>, UTF32<> >("utf32le.json", false);
297  TestEncodedOutputStream<UTF32LE<>, UTF32<> >("utf32lebom.json",true);
298  TestEncodedOutputStream<UTF32BE<>, UTF32<> >("utf32be.json", false);
299  TestEncodedOutputStream<UTF32BE<>, UTF32<> >("utf32bebom.json",true);
300 }
UTF-32 encoding.
Definition: encodings.h:418
UTF-16 encoding.
Definition: encodings.h:269
UTF-8 encoding.
Definition: encodings.h:96

◆ TEST_F() [4/4]

Definition at line 302 of file encodedstreamtest.cpp.

302  {
303  TestAutoUTFOutputStream(kUTF8, false, "utf8.json");
304  TestAutoUTFOutputStream(kUTF8, true, "utf8bom.json");
305  TestAutoUTFOutputStream(kUTF16LE, false, "utf16le.json");
306  TestAutoUTFOutputStream(kUTF16LE, true, "utf16lebom.json");
307  TestAutoUTFOutputStream(kUTF16BE, false, "utf16be.json");
308  TestAutoUTFOutputStream(kUTF16BE, true, "utf16bebom.json");
309  TestAutoUTFOutputStream(kUTF32LE, false, "utf32le.json");
310  TestAutoUTFOutputStream(kUTF32LE, true, "utf32lebom.json");
311  TestAutoUTFOutputStream(kUTF32BE, false, "utf32be.json");
312  TestAutoUTFOutputStream(kUTF32BE, true, "utf32bebom.json");
313 }
UTF-32 big endian.
Definition: encodings.h:608
UTF-16 little endian.
Definition: encodings.h:605
UTF-8.
Definition: encodings.h:604
UTF-16 big endian.
Definition: encodings.h:606
UTF-32 little endian.
Definition: encodings.h:607