38TEST(ChunkGeneratorTest, StartingConditions)
41 EXPECT_EQ(0, chunk_generator.
addr());
42 EXPECT_EQ(8, chunk_generator.
size());
43 EXPECT_EQ(0, chunk_generator.
complete());
44 EXPECT_FALSE(chunk_generator.
done());
45 EXPECT_FALSE(chunk_generator.
last());
51TEST(ChunkGeneratorTest, AdvanceToNextChunk)
54 EXPECT_EQ(0, chunk_generator.
addr());
55 EXPECT_TRUE(chunk_generator.
next());
56 EXPECT_EQ(8, chunk_generator.
addr());
57 EXPECT_EQ(8, chunk_generator.
size());
58 EXPECT_EQ(8, chunk_generator.
complete());
59 EXPECT_FALSE(chunk_generator.
done());
60 EXPECT_FALSE(chunk_generator.
last());
66TEST(ChunkGeneratorTest, SkipBytes)
69 EXPECT_EQ(0, chunk_generator.
addr());
70 EXPECT_TRUE(chunk_generator.
next());
71 EXPECT_EQ(8, chunk_generator.
addr());
74 EXPECT_EQ(23 - 8, chunk_generator.
size());
75 EXPECT_TRUE(chunk_generator.
next());
76 EXPECT_EQ(23, chunk_generator.
addr());
77 EXPECT_EQ(1, chunk_generator.
size());
78 EXPECT_TRUE(chunk_generator.
next());
79 EXPECT_EQ(24, chunk_generator.
addr());
80 EXPECT_EQ(8, chunk_generator.
size());
83 EXPECT_EQ(32 - 24, chunk_generator.
size());
84 EXPECT_TRUE(chunk_generator.
next());
85 EXPECT_EQ(32, chunk_generator.
addr());
86 EXPECT_EQ(8, chunk_generator.
size());
89 EXPECT_EQ(64 - 32, chunk_generator.
size());
90 EXPECT_TRUE(chunk_generator.
next());
91 EXPECT_EQ(64, chunk_generator.
addr());
92 EXPECT_EQ(8, chunk_generator.
size());
95 EXPECT_EQ(1024 - 64, chunk_generator.
size());
96 EXPECT_TRUE(chunk_generator.
last());
97 EXPECT_FALSE(chunk_generator.
next());
98 EXPECT_TRUE(chunk_generator.
done());
104TEST(ChunkGeneratorTest, AdvanceToLastChunk)
107 EXPECT_EQ(0, chunk_generator.
addr());
108 EXPECT_TRUE(chunk_generator.
next());
109 EXPECT_EQ(8, chunk_generator.
addr());
110 EXPECT_TRUE(chunk_generator.
next());
111 EXPECT_EQ(16, chunk_generator.
addr());
112 EXPECT_TRUE(chunk_generator.
next());
113 EXPECT_EQ(24, chunk_generator.
addr());
114 EXPECT_EQ(8, chunk_generator.
size());
115 EXPECT_EQ(24, chunk_generator.
complete());
116 EXPECT_FALSE(chunk_generator.
done());
117 EXPECT_TRUE(chunk_generator.
last());
123TEST(ChunkGeneratorTest, AdvanceToTheEnd)
126 EXPECT_EQ(0, chunk_generator.
addr());
127 EXPECT_TRUE(chunk_generator.
next());
128 EXPECT_EQ(8, chunk_generator.
addr());
129 EXPECT_TRUE(chunk_generator.
next());
130 EXPECT_EQ(16, chunk_generator.
addr());
131 EXPECT_TRUE(chunk_generator.
next());
132 EXPECT_EQ(24, chunk_generator.
addr());
138 EXPECT_FALSE(chunk_generator.
next());
139 EXPECT_EQ(24, chunk_generator.
addr());
140 EXPECT_EQ(0, chunk_generator.
size());
141 EXPECT_EQ(24, chunk_generator.
complete());
142 EXPECT_TRUE(chunk_generator.
done());
143 EXPECT_TRUE(chunk_generator.
last());
150TEST(ChunkGeneratorTest, SmallerLastChunk)
154 EXPECT_EQ(0, chunk_generator.
addr());
155 EXPECT_TRUE(chunk_generator.
next());
156 EXPECT_EQ(8, chunk_generator.
addr());
157 EXPECT_EQ(6, chunk_generator.
size());
158 EXPECT_EQ(8, chunk_generator.
complete());
159 EXPECT_FALSE(chunk_generator.
done());
160 EXPECT_TRUE(chunk_generator.
last());
168TEST(ChunkGeneratorTest, ChunkSizeGreaterThanTotalSize)
171 EXPECT_EQ(0, chunk_generator.
addr());
172 EXPECT_EQ(32, chunk_generator.
size());
173 EXPECT_EQ(0, chunk_generator.
complete());
174 EXPECT_FALSE(chunk_generator.
done());
175 EXPECT_TRUE(chunk_generator.
last());
178 EXPECT_FALSE(chunk_generator.
next());
179 EXPECT_EQ(0, chunk_generator.
addr());
180 EXPECT_EQ(0, chunk_generator.
size());
181 EXPECT_EQ(0, chunk_generator.
complete());
182 EXPECT_TRUE(chunk_generator.
done());
183 EXPECT_TRUE(chunk_generator.
last());
191TEST(ChunkGeneratorTest, ChunkSizeZero)
194 EXPECT_EQ(0, chunk_generator.
addr());
195 EXPECT_EQ(64, chunk_generator.
size());
196 EXPECT_EQ(0, chunk_generator.
complete());
197 EXPECT_FALSE(chunk_generator.
done());
198 EXPECT_TRUE(chunk_generator.
last());
201 EXPECT_FALSE(chunk_generator.
next());
202 EXPECT_EQ(0, chunk_generator.
addr());
203 EXPECT_EQ(0, chunk_generator.
size());
204 EXPECT_EQ(0, chunk_generator.
complete());
205 EXPECT_TRUE(chunk_generator.
done());
206 EXPECT_TRUE(chunk_generator.
last());
212TEST(ChunkGeneratorTest, StartAtNonZero)
215 EXPECT_EQ(4, chunk_generator.
addr());
216 EXPECT_EQ(4, chunk_generator.
size());
217 EXPECT_EQ(0, chunk_generator.
complete());
218 EXPECT_FALSE(chunk_generator.
done());
219 EXPECT_FALSE(chunk_generator.
last());
225 EXPECT_TRUE(chunk_generator.
next());
226 EXPECT_EQ(8, chunk_generator.
addr());
227 EXPECT_EQ(8, chunk_generator.
size());
228 EXPECT_EQ(4, chunk_generator.
complete());
229 EXPECT_FALSE(chunk_generator.
done());
230 EXPECT_FALSE(chunk_generator.
last());
233 EXPECT_TRUE(chunk_generator.
next());
234 EXPECT_EQ(16, chunk_generator.
addr());
235 EXPECT_EQ(8, chunk_generator.
size());
236 EXPECT_EQ(12, chunk_generator.
complete());
237 EXPECT_FALSE(chunk_generator.
done());
238 EXPECT_FALSE(chunk_generator.
last());
240 EXPECT_TRUE(chunk_generator.
next());
241 EXPECT_EQ(24, chunk_generator.
addr());
242 EXPECT_EQ(8, chunk_generator.
size());
243 EXPECT_EQ(20, chunk_generator.
complete());
244 EXPECT_FALSE(chunk_generator.
done());
245 EXPECT_FALSE(chunk_generator.
last());
248 EXPECT_TRUE(chunk_generator.
next());
249 EXPECT_EQ(32, chunk_generator.
addr());
250 EXPECT_EQ(4, chunk_generator.
size());
251 EXPECT_EQ(28, chunk_generator.
complete());
252 EXPECT_FALSE(chunk_generator.
done());
253 EXPECT_TRUE(chunk_generator.
last());
255 EXPECT_FALSE(chunk_generator.
next());
256 EXPECT_EQ(32, chunk_generator.
addr());
257 EXPECT_EQ(0, chunk_generator.
size());
258 EXPECT_EQ(28, chunk_generator.
complete());
259 EXPECT_TRUE(chunk_generator.
done());
260 EXPECT_TRUE(chunk_generator.
last());