18
18
#include " gtest/gtest.h"
19
19
20
20
using namespace llvm ;
21
- using namespace llvm ::support;
22
21
using namespace swift ;
23
22
24
23
class ExponentialGrowthAppendingBinaryByteStreamTest : public testing ::Test {};
@@ -27,7 +26,7 @@ class ExponentialGrowthAppendingBinaryByteStreamTest : public testing::Test {};
27
26
// unittests/BinaryStreamTests.cpp in the LLVM project
28
27
TEST_F (ExponentialGrowthAppendingBinaryByteStreamTest, ReadAndWrite) {
29
28
StringRef Strings[] = {" 1" , " 2" , " 3" , " 4" };
30
- ExponentialGrowthAppendingBinaryByteStream Stream (support::little );
29
+ auto Stream = ExponentialGrowthAppendingBinaryByteStream ( );
31
30
32
31
BinaryStreamWriter Writer (Stream);
33
32
BinaryStreamReader Reader (Stream);
@@ -76,7 +75,7 @@ TEST_F(ExponentialGrowthAppendingBinaryByteStreamTest, ReadAndWrite) {
76
75
}
77
76
78
77
TEST_F (ExponentialGrowthAppendingBinaryByteStreamTest, WriteAtInvalidOffset) {
79
- ExponentialGrowthAppendingBinaryByteStream Stream (llvm::support::little );
78
+ auto Stream = ExponentialGrowthAppendingBinaryByteStream ( );
80
79
EXPECT_EQ (0U , Stream.getLength ());
81
80
82
81
std::vector<uint8_t > InputData = {' T' , ' e' , ' s' , ' t' , ' T' , ' e' , ' s' , ' t' };
@@ -97,7 +96,7 @@ TEST_F(ExponentialGrowthAppendingBinaryByteStreamTest, WriteAtInvalidOffset) {
97
96
TEST_F (ExponentialGrowthAppendingBinaryByteStreamTest, InitialSizeZero) {
98
97
// Test that the stream also works with an initial size of 0, which doesn't
99
98
// grow when doubled.
100
- ExponentialGrowthAppendingBinaryByteStream Stream (llvm::support::little );
99
+ auto Stream = ExponentialGrowthAppendingBinaryByteStream ( );
101
100
102
101
std::vector<uint8_t > InputData = {' T' , ' e' , ' s' , ' t' };
103
102
auto Test = makeArrayRef (InputData).take_front (4 );
@@ -106,7 +105,7 @@ TEST_F(ExponentialGrowthAppendingBinaryByteStreamTest, InitialSizeZero) {
106
105
}
107
106
108
107
TEST_F (ExponentialGrowthAppendingBinaryByteStreamTest, GrowMultipleSteps) {
109
- ExponentialGrowthAppendingBinaryByteStream Stream (llvm::support::little );
108
+ auto Stream = ExponentialGrowthAppendingBinaryByteStream ( );
110
109
111
110
// Test that the buffer can grow multiple steps at once, e.g. 1 -> 2 -> 4
112
111
std::vector<uint8_t > InputData = {' T' , ' e' , ' s' , ' t' };
@@ -116,7 +115,7 @@ TEST_F(ExponentialGrowthAppendingBinaryByteStreamTest, GrowMultipleSteps) {
116
115
}
117
116
118
117
TEST_F (ExponentialGrowthAppendingBinaryByteStreamTest, WriteIntoMiddle) {
119
- ExponentialGrowthAppendingBinaryByteStream Stream (llvm::support::little );
118
+ auto Stream = ExponentialGrowthAppendingBinaryByteStream ( );
120
119
121
120
// Test that the stream resizes correctly if we write into its middle
122
121
std::vector<uint8_t > InitialData = {' T' , ' e' , ' s' , ' t' };
@@ -143,16 +142,16 @@ TEST_F(ExponentialGrowthAppendingBinaryByteStreamTest, WriteIntoMiddle) {
143
142
EXPECT_EQ (6u , Stream.getLength ());
144
143
}
145
144
146
- TEST_F (ExponentialGrowthAppendingBinaryByteStreamTest, WriteRaw ) {
147
- ExponentialGrowthAppendingBinaryByteStream Stream (llvm::support::little );
145
+ TEST_F (ExponentialGrowthAppendingBinaryByteStreamTest, WriteInteger ) {
146
+ auto Stream = ExponentialGrowthAppendingBinaryByteStream ( );
148
147
149
- // Test the writeRaw method
148
+ // Test the writeInteger method
150
149
std::vector<uint8_t > InitialData = {' H' , ' e' , ' l' , ' l' , ' o' };
151
150
auto InitialDataRef = makeArrayRef (InitialData);
152
151
EXPECT_THAT_ERROR (Stream.writeBytes (0 , InitialDataRef), Succeeded ());
153
152
EXPECT_EQ (InitialDataRef, Stream.data ());
154
153
155
- EXPECT_THAT_ERROR (Stream.writeRaw (5 , (uint8_t )' ' ), Succeeded ());
154
+ EXPECT_THAT_ERROR (Stream.writeInteger (5 , (uint8_t )' ' ), Succeeded ());
156
155
std::vector<uint8_t > AfterFirstInsert = {' H' , ' e' , ' l' , ' l' , ' o' , ' ' };
157
156
auto AfterFirstInsertRef = makeArrayRef (AfterFirstInsert);
158
157
EXPECT_EQ (AfterFirstInsertRef, Stream.data ());
@@ -162,7 +161,7 @@ TEST_F(ExponentialGrowthAppendingBinaryByteStreamTest, WriteRaw) {
162
161
' o' << 8 |
163
162
' r' << 16 |
164
163
' l' << 24 ;
165
- EXPECT_THAT_ERROR (Stream.writeRaw (6 , ToInsert), Succeeded ());
164
+ EXPECT_THAT_ERROR (Stream.writeInteger (6 , ToInsert), Succeeded ());
166
165
std::vector<uint8_t > AfterSecondInsert = {' H' , ' e' , ' l' , ' l' , ' o' , ' ' ,
167
166
' w' , ' o' , ' r' , ' l' };
168
167
auto AfterSecondInsertRef = makeArrayRef (AfterSecondInsert);
0 commit comments