30 #define CATCH_CONFIG_MAIN
31 #include <catch2/catch_amalgamated.hpp>
80 std::vector<TrivialType> array(capacity);
136 std::vector<TrivialType> array(len);
207 ", trivially_copyable "+
std::to_string(std::is_trivially_copyable<typename TrivialTypeRingbuffer::value_type>::value)+
209 fprintf(stderr,
"%s", msg.c_str());
216 std::vector<TrivialType> source = createIntArray(capacity, 0);
222 readTestImpl(rb,
true, capacity, capacity, 0);
230 INFO( std::string(
"test02_EmptyWrite: Created / ") + rb.
toString().c_str());
234 writeTestImpl(rb, capacity, capacity, 0);
235 INFO( std::string(
"test02_EmptyWrite: PostWrite / ") + rb.
toString().c_str());
239 readTestImpl(rb,
true, capacity, capacity, 0);
240 INFO( std::string(
"test02_EmptyWrite: PostRead / ") + rb.
toString().c_str());
249 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
257 std::vector<TrivialType> new_data = createIntArray(capacity, 0);
258 writeRangeTestImpl(rb, capacity, new_data);
260 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
264 readRangeTestImpl(rb,
true, capacity, capacity, 0);
265 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
274 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
289 std::vector<TrivialType> new_data = createIntArray(capacity, 0);
290 writeRangeTestImpl(rb, capacity, new_data);
293 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
297 readRangeTestImpl(rb,
true, capacity, capacity, 0);
300 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
308 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
328 std::vector<TrivialType> new_data = createIntArray(capacity-2, 0);
329 writeRangeTestImpl(rb, capacity, new_data);
332 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
340 readRangeTestImpl(rb,
true, capacity, capacity-2, 0);
342 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
351 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
361 for(
int i=0; i<11; i++) { rb.
put(dummy); }
368 for(
int i=0; i<2; i++) { rb.
put(dummy); }
374 std::vector<TrivialType> new_data = createIntArray(capacity-3, 0);
375 writeRangeTestImpl(rb, capacity, new_data);
378 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
387 readRangeTestImpl(rb,
true, capacity, capacity-3, 0);
389 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
398 std::vector<TrivialType> source = createIntArray(capacity, 0);
407 readTestImpl(rb,
false, capacity, capacity, 0);
415 readTestImpl2(rb,
false, capacity, capacity, 0);
428 writeTestImpl(rb, capacity, capacity, 0);
431 readTestImpl(rb,
false, capacity, capacity, 0);
437 writeTestImpl(rb, capacity, capacity, 0);
440 readTestImpl2(rb,
false, capacity, capacity, 0);
446 std::vector<TrivialType> source = createIntArray(capacity, 0);
453 readTestImpl(rb,
false, capacity, 5, 0);
460 readTestImpl(rb,
false, capacity, capacity, 0);
466 std::vector<TrivialType> source = createIntArray(capacity, 0);
473 moveGetPutImpl(rb, 5);
474 readTestImpl(rb,
false, capacity, 5, 5);
481 readTestImpl(rb,
false, capacity, capacity, 0);
489 jau::nsize_t grownCapacity = initialCapacity+growAmount;
490 std::vector<TrivialType> source = createIntArray(initialCapacity, 0);
503 moveGetPutImpl(rb, pos);
544 test_GrowFullImpl(11, 0);
547 test_GrowFullImpl(11, 0+1);
550 test_GrowFullImpl(11, 0+2);
553 test_GrowFullImpl(11, 0+3);
556 test_GrowFullImpl(11, 11-1);
559 test_GrowFullImpl(11, 11-1-1);
562 test_GrowFullImpl(11, 11-1-2);
565 test_GrowFullImpl(11, 11-1-3);