• Home
  • Raw
  • Download

Lines Matching refs:buf

53   Buffer buf(kTestData, 7);  in TEST()  local
54 EXPECT_EQ(buf.size(), 7u); in TEST()
55 EXPECT_EQ(buf.capacity(), 7u); in TEST()
56 EXPECT_FALSE(buf.empty()); in TEST()
57 EXPECT_EQ(0, memcmp(buf.data(), kTestData, 7)); in TEST()
61 Buffer buf(kTestData, 7, 14); in TEST() local
62 EXPECT_EQ(buf.size(), 7u); in TEST()
63 EXPECT_EQ(buf.capacity(), 14u); in TEST()
64 EXPECT_FALSE(buf.empty()); in TEST()
65 EXPECT_EQ(0, memcmp(buf.data(), kTestData, 7)); in TEST()
69 Buffer buf(kTestData); in TEST() local
70 EXPECT_EQ(buf.size(), 16u); in TEST()
71 EXPECT_EQ(buf.capacity(), 16u); in TEST()
72 EXPECT_FALSE(buf.empty()); in TEST()
73 EXPECT_EQ(0, memcmp(buf.data(), kTestData, 16)); in TEST()
77 Buffer buf(kTestData + 4, 7); in TEST() local
78 buf.SetData(kTestData, 9); in TEST()
79 EXPECT_EQ(buf.size(), 9u); in TEST()
80 EXPECT_EQ(buf.capacity(), 7u * 3 / 2); in TEST()
81 EXPECT_FALSE(buf.empty()); in TEST()
82 EXPECT_EQ(0, memcmp(buf.data(), kTestData, 9)); in TEST()
84 buf2.SetData(buf); in TEST()
85 EXPECT_EQ(buf.size(), 9u); in TEST()
86 EXPECT_EQ(buf.capacity(), 7u * 3 / 2); in TEST()
87 EXPECT_EQ(0, memcmp(buf.data(), kTestData, 9)); in TEST()
91 Buffer buf(kTestData + 4, 3); in TEST() local
92 buf.AppendData(kTestData + 10, 2); in TEST()
94 EXPECT_EQ(buf, Buffer(exp)); in TEST()
96 buf2.AppendData(buf); in TEST()
97 buf2.AppendData(rtc::ArrayView<uint8_t>(buf)); in TEST()
107 Buffer buf; in TEST() local
108 buf.SetData(TestDataContainer()); in TEST()
109 EXPECT_EQ(3u, buf.size()); in TEST()
110 EXPECT_EQ(Buffer(kTestData, 3), buf); in TEST()
111 EXPECT_THAT(buf, ElementsAre(0, 1, 2)); in TEST()
112 buf.AppendData(TestDataContainer()); in TEST()
113 EXPECT_EQ(6u, buf.size()); in TEST()
114 EXPECT_EQ(0, memcmp(buf.data(), kTestData, 3)); in TEST()
115 EXPECT_EQ(0, memcmp(buf.data() + 3, kTestData, 3)); in TEST()
116 EXPECT_THAT(buf, ElementsAre(0, 1, 2, 0, 1, 2)); in TEST()
120 Buffer buf; in TEST() local
121 buf.SetData(kTestData, 15); in TEST()
122 buf.SetSize(10); in TEST()
123 EXPECT_EQ(buf.size(), 10u); in TEST()
124 EXPECT_EQ(buf.capacity(), 15u); // Hasn't shrunk. in TEST()
125 EXPECT_FALSE(buf.empty()); in TEST()
126 EXPECT_EQ(buf, Buffer(kTestData, 10)); in TEST()
130 Buffer buf; in TEST() local
131 buf.SetData(kTestData, 15); in TEST()
132 EXPECT_EQ(buf.size(), 15u); in TEST()
133 EXPECT_EQ(buf.capacity(), 15u); in TEST()
134 EXPECT_FALSE(buf.empty()); in TEST()
135 buf.SetSize(20); in TEST()
136 EXPECT_EQ(buf.size(), 20u); in TEST()
137 EXPECT_EQ(buf.capacity(), 15u * 3 / 2); // Has grown. in TEST()
138 EXPECT_FALSE(buf.empty()); in TEST()
139 EXPECT_EQ(0, memcmp(buf.data(), kTestData, 15)); in TEST()
143 Buffer buf(kTestData); in TEST() local
144 const char* data = buf.data<char>(); in TEST()
145 buf.EnsureCapacity(4); in TEST()
146 EXPECT_EQ(buf.capacity(), 16u); // Hasn't shrunk. in TEST()
147 EXPECT_EQ(buf.data<char>(), data); // No reallocation. in TEST()
148 EXPECT_FALSE(buf.empty()); in TEST()
149 EXPECT_EQ(buf, Buffer(kTestData)); in TEST()
153 Buffer buf(kTestData, 5); in TEST() local
154 buf.EnsureCapacity(10); in TEST()
155 const int8_t* data = buf.data<int8_t>(); in TEST()
156 EXPECT_EQ(buf.capacity(), 10u); in TEST()
157 buf.AppendData(kTestData + 5, 5); in TEST()
158 EXPECT_EQ(buf.data<int8_t>(), data); // No reallocation. in TEST()
159 EXPECT_FALSE(buf.empty()); in TEST()
160 EXPECT_EQ(buf, Buffer(kTestData, 10)); in TEST()
200 Buffer buf(kTestData, 3, 40); in TEST() local
201 Buffer* buf_ptr = &buf; in TEST()
202 buf = std::move(*buf_ptr); in TEST()
223 Buffer buf; in TEST() local
224 buf.SetData(kTestData, 15); in TEST()
225 EXPECT_EQ(buf.size(), 15u); in TEST()
226 EXPECT_EQ(buf.capacity(), 15u); in TEST()
227 EXPECT_FALSE(buf.empty()); in TEST()
228 const char* data = buf.data<char>(); in TEST()
229 buf.Clear(); in TEST()
230 EXPECT_EQ(buf.size(), 0u); in TEST()
231 EXPECT_EQ(buf.capacity(), 15u); // Hasn't shrunk. in TEST()
232 EXPECT_EQ(buf.data<char>(), data); // No reallocation. in TEST()
233 EXPECT_TRUE(buf.empty()); in TEST()
301 Buffer buf; in TEST() local
302 EXPECT_EQ(buf.AppendData(15, setter), 7u); in TEST()
303 EXPECT_EQ(buf.size(), 7u); // Size is exactly what we wrote. in TEST()
304 EXPECT_GE(buf.capacity(), 7u); // Capacity is valid. in TEST()
305 EXPECT_NE(buf.data<char>(), nullptr); // Data is actually stored. in TEST()
306 EXPECT_FALSE(buf.empty()); in TEST()
321 Buffer buf; in TEST() local
322 EXPECT_EQ(buf.SetData(15, setter), 15u); in TEST()
323 EXPECT_EQ(buf.AppendData(15, setter), 15u); in TEST()
324 EXPECT_EQ(buf.size(), 30u); // Size is exactly what we wrote. in TEST()
325 EXPECT_GE(buf.capacity(), 30u); // Capacity is valid. in TEST()
326 EXPECT_NE(buf.data<char>(), nullptr); // Data is actually stored. in TEST()
327 EXPECT_FALSE(buf.empty()); in TEST()
329 for (uint8_t i = 0; i != buf.size(); ++i) { in TEST()
330 EXPECT_EQ(buf.data()[i], magic_number + i); in TEST()
335 Buffer buf(kTestData, 7); in TEST() local
336 EXPECT_EQ(buf.size(), 7u); in TEST()
337 EXPECT_EQ(buf.capacity(), 7u); in TEST()
338 EXPECT_NE(buf.data(), nullptr); in TEST()
339 EXPECT_FALSE(buf.empty()); in TEST()
342 EXPECT_EQ(buf[i], kTestData[i]); in TEST()
347 Buffer buf(kTestData, 7); in TEST() local
348 EXPECT_EQ(buf.size(), 7u); in TEST()
349 EXPECT_EQ(buf.capacity(), 7u); in TEST()
350 EXPECT_NE(buf.data(), nullptr); in TEST()
351 EXPECT_FALSE(buf.empty()); in TEST()
353 const Buffer& cbuf = buf; in TEST()
361 Buffer buf(7); in TEST() local
362 EXPECT_EQ(buf.size(), 7u); in TEST()
363 EXPECT_EQ(buf.capacity(), 7u); in TEST()
364 EXPECT_NE(buf.data(), nullptr); in TEST()
365 EXPECT_FALSE(buf.empty()); in TEST()
368 buf[i] = kTestData[i]; in TEST()
371 EXPECT_THAT(buf, ElementsAreArray(kTestData, 7)); in TEST()
376 Buffer buf(kTestData); in TEST() local
378 for (auto& x : buf) { in TEST()
384 auto* b2 = buf.begin(); in TEST()
389 EXPECT_EQ(buf.end(), b2); in TEST()
394 BufferT<int16_t> buf(test_data); in TEST() local
395 EXPECT_EQ(buf.size(), 5u); in TEST()
396 EXPECT_EQ(buf.capacity(), 5u); in TEST()
397 EXPECT_NE(buf.data(), nullptr); in TEST()
398 EXPECT_FALSE(buf.empty()); in TEST()
399 EXPECT_THAT(buf, ElementsAreArray(test_data)); in TEST()
401 EXPECT_EQ(buf, buf2); in TEST()
403 EXPECT_NE(buf, buf2); in TEST()
408 BufferT<float> buf; in TEST() local
409 EXPECT_EQ(buf.size(), 0u); in TEST()
410 EXPECT_EQ(buf.capacity(), 0u); in TEST()
411 EXPECT_EQ(buf.data(), nullptr); in TEST()
412 EXPECT_TRUE(buf.empty()); in TEST()
413 buf.SetData(test_data); in TEST()
414 EXPECT_EQ(buf.size(), 5u); in TEST()
415 EXPECT_EQ(buf.capacity(), 5u); in TEST()
416 EXPECT_NE(buf.data(), nullptr); in TEST()
417 EXPECT_FALSE(buf.empty()); in TEST()
418 float* p1 = buf.data(); in TEST()
419 while (buf.data() == p1) { in TEST()
420 buf.AppendData(test_data); in TEST()
422 EXPECT_EQ(buf.size(), buf.capacity()); in TEST()
423 EXPECT_GT(buf.size(), 5u); in TEST()
424 EXPECT_EQ(buf.size() % 5, 0u); in TEST()
425 EXPECT_NE(buf.data(), nullptr); in TEST()
426 for (size_t i = 0; i != buf.size(); ++i) { in TEST()
427 EXPECT_EQ(test_data[i % 5], buf[i]); in TEST()
436 BufferT<BloodStone> buf(4); in TEST() local
437 EXPECT_EQ(buf.size(), 4u); in TEST()
438 EXPECT_EQ(buf.capacity(), 4u); in TEST()
439 EXPECT_NE(buf.data(), nullptr); in TEST()
440 EXPECT_FALSE(buf.empty()); in TEST()
443 buf2[i] = &buf[i]; in TEST()
447 EXPECT_EQ(kObsidian, buf[2].stone); in TEST()
451 Buffer buf(17); in TEST() local
452 Buffer buf2 = std::move(buf); in TEST()
456 EXPECT_DEATH(buf.empty(), ""); in TEST()
459 EXPECT_TRUE(buf.empty()); in TEST()
464 ZeroOnFreeBuffer<uint8_t> buf(kTestData, 7); in TEST() local
465 const uint8_t* old_data = buf.data(); in TEST()
466 const size_t old_capacity = buf.capacity(); in TEST()
467 const size_t old_size = buf.size(); in TEST()
469 buf.SetData(kTestData + offset, 2); in TEST()
471 EXPECT_EQ(old_data, buf.data()); in TEST()
472 EXPECT_EQ(old_capacity, buf.capacity()); in TEST()
475 EXPECT_EQ(kTestData[offset], buf[0]); in TEST()
476 EXPECT_EQ(kTestData[offset + 1], buf[1]); in TEST()
490 ZeroOnFreeBuffer<uint8_t> buf(kTestData, 7); in TEST() local
491 const uint8_t* old_data = buf.data(); in TEST()
492 const size_t old_capacity = buf.capacity(); in TEST()
493 const size_t old_size = buf.size(); in TEST()
494 buf.SetData(2, setter); in TEST()
496 EXPECT_EQ(old_data, buf.data()); in TEST()
497 EXPECT_EQ(old_capacity, buf.capacity()); in TEST()
500 EXPECT_EQ(kTestData[offset], buf[0]); in TEST()
501 EXPECT_EQ(kTestData[offset + 1], buf[1]); in TEST()
508 ZeroOnFreeBuffer<uint8_t> buf(kTestData, 7); in TEST() local
509 const uint8_t* old_data = buf.data(); in TEST()
510 const size_t old_capacity = buf.capacity(); in TEST()
511 const size_t old_size = buf.size(); in TEST()
512 buf.SetSize(2); in TEST()
514 EXPECT_EQ(old_data, buf.data()); in TEST()
515 EXPECT_EQ(old_capacity, buf.capacity()); in TEST()
518 EXPECT_EQ(kTestData[0], buf[0]); in TEST()
519 EXPECT_EQ(kTestData[1], buf[1]); in TEST()
526 ZeroOnFreeBuffer<uint8_t> buf(kTestData, 7); in TEST() local
527 const uint8_t* old_data = buf.data(); in TEST()
528 const size_t old_capacity = buf.capacity(); in TEST()
529 const size_t old_size = buf.size(); in TEST()
530 buf.Clear(); in TEST()
532 EXPECT_EQ(old_data, buf.data()); in TEST()
533 EXPECT_EQ(old_capacity, buf.capacity()); in TEST()