Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
stringbuffertest.cpp File Reference
#include "unittest.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
Include dependency graph for stringbuffertest.cpp:

Go to the source code of this file.

Functions

 TEST (StringBuffer, InitialSize)
 
 TEST (StringBuffer, Put)
 
 TEST (StringBuffer, PutN_Issue672)
 
 TEST (StringBuffer, Clear)
 
 TEST (StringBuffer, Push)
 
 TEST (StringBuffer, Pop)
 
 TEST (StringBuffer, GetLength_Issue744)
 

Function Documentation

◆ TEST() [1/7]

TEST ( StringBuffer ,
Clear  )

Definition at line 51 of file stringbuffertest.cpp.

51 {
52 StringBuffer buffer;
53 buffer.Put('A');
54 buffer.Put('B');
55 buffer.Put('C');
56 buffer.Clear();
57
58 EXPECT_EQ(0u, buffer.GetSize());
59 EXPECT_EQ(0u, buffer.GetLength());
60 EXPECT_STREQ("", buffer.GetString());
61}
const Ch * GetString() const
size_t GetSize() const
Get the size of string in bytes in the string buffer.
size_t GetLength() const
Get the length of string in Ch in the string buffer.
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954
#define EXPECT_STREQ(s1, s2)
Definition gtest.h:2027
Here is the call graph for this function:

◆ TEST() [2/7]

TEST ( StringBuffer ,
GetLength_Issue744  )

Definition at line 89 of file stringbuffertest.cpp.

89 {
91 buffer.Put('A');
92 buffer.Put('B');
93 buffer.Put('C');
94 EXPECT_EQ(3u * sizeof(wchar_t), buffer.GetSize());
95 EXPECT_EQ(3u, buffer.GetLength());
96}
Here is the call graph for this function:

◆ TEST() [3/7]

TEST ( StringBuffer ,
InitialSize  )

Definition at line 26 of file stringbuffertest.cpp.

26 {
27 StringBuffer buffer;
28 EXPECT_EQ(0u, buffer.GetSize());
29 EXPECT_EQ(0u, buffer.GetLength());
30 EXPECT_STREQ("", buffer.GetString());
31}
Here is the call graph for this function:

◆ TEST() [4/7]

TEST ( StringBuffer ,
Pop  )

Definition at line 75 of file stringbuffertest.cpp.

75 {
76 StringBuffer buffer;
77 buffer.Put('A');
78 buffer.Put('B');
79 buffer.Put('C');
80 buffer.Put('D');
81 buffer.Put('E');
82 buffer.Pop(3);
83
84 EXPECT_EQ(2u, buffer.GetSize());
85 EXPECT_EQ(2u, buffer.GetLength());
86 EXPECT_STREQ("AB", buffer.GetString());
87}
void Pop(size_t count)
Here is the call graph for this function:

◆ TEST() [5/7]

TEST ( StringBuffer ,
Push  )

Definition at line 63 of file stringbuffertest.cpp.

63 {
64 StringBuffer buffer;
65 buffer.Push(5);
66
67 EXPECT_EQ(5u, buffer.GetSize());
68 EXPECT_EQ(5u, buffer.GetLength());
69
70 // Causes sudden expansion to make the stack's capacity equal to size
71 buffer.Push(65536u);
72 EXPECT_EQ(5u + 65536u, buffer.GetSize());
73}
Ch * Push(size_t count)
Here is the call graph for this function:

◆ TEST() [6/7]

TEST ( StringBuffer ,
Put  )

Definition at line 33 of file stringbuffertest.cpp.

33 {
34 StringBuffer buffer;
35 buffer.Put('A');
36
37 EXPECT_EQ(1u, buffer.GetSize());
38 EXPECT_EQ(1u, buffer.GetLength());
39 EXPECT_STREQ("A", buffer.GetString());
40}
Here is the call graph for this function:

◆ TEST() [7/7]

TEST ( StringBuffer ,
PutN_Issue672  )

Definition at line 42 of file stringbuffertest.cpp.

42 {
44 EXPECT_EQ(0u, buffer.GetSize());
45 EXPECT_EQ(0u, buffer.GetLength());
46 rapidjson::PutN(buffer, ' ', 1);
47 EXPECT_EQ(1u, buffer.GetSize());
48 EXPECT_EQ(1u, buffer.GetLength());
49}
Default memory allocator used by the parser and DOM.
Definition allocators.h:115
Here is the call graph for this function: