30 #define CATCH_CONFIG_MAIN
31 #include <catch2/catch_amalgamated.hpp>
59 std::vector<TrivialType> array(capacity);
115 std::vector<TrivialType> array(len);
186 ", trivially_copyable "+
std::to_string(std::is_trivially_copyable<typename TrivialTypeRingbuffer::value_type>::value)+
188 fprintf(stderr,
"%s", msg.c_str());
195 std::vector<TrivialType> source = createIntArray(capacity, 0);
201 readTestImpl(rb,
true, capacity, capacity, 0);
209 INFO( std::string(
"test02_EmptyWrite: Created / ") + rb.
toString().c_str());
213 writeTestImpl(rb, capacity, capacity, 0);
214 INFO( std::string(
"test02_EmptyWrite: PostWrite / ") + rb.
toString().c_str());
218 readTestImpl(rb,
true, capacity, capacity, 0);
219 INFO( std::string(
"test02_EmptyWrite: PostRead / ") + rb.
toString().c_str());
227 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
235 std::vector<TrivialType> new_data = createIntArray(capacity, 0);
236 writeRangeTestImpl(rb, capacity, new_data);
238 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
242 readRangeTestImpl(rb,
true, capacity, capacity, 0);
243 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
250 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
265 std::vector<TrivialType> new_data = createIntArray(capacity, 0);
266 writeRangeTestImpl(rb, capacity, new_data);
269 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
273 readRangeTestImpl(rb,
true, capacity, capacity, 0);
276 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
282 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
302 std::vector<TrivialType> new_data = createIntArray(capacity-2, 0);
303 writeRangeTestImpl(rb, capacity, new_data);
306 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
314 readRangeTestImpl(rb,
true, capacity, capacity-2, 0);
316 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
323 INFO( std::string(
"test03_EmptyWriteRange: Created / ") + rb.
toString().c_str());
333 for(
int i=0; i<11; i++) { rb.
put(dummy); }
339 for(
int i=0; i<2; i++) { rb.
put(dummy); }
345 std::vector<TrivialType> new_data = createIntArray(capacity-3, 0);
346 writeRangeTestImpl(rb, capacity, new_data);
349 INFO( std::string(
"test03_EmptyWriteRange: PostWrite / ") + rb.
toString().c_str());
357 readRangeTestImpl(rb,
true, capacity, capacity-3, 0);
359 INFO( std::string(
"test03_EmptyWriteRange: PostRead / ") + rb.
toString().c_str());
367 std::vector<TrivialType> source = createIntArray(capacity, 0);
376 readTestImpl(rb,
false, capacity, capacity, 0);
384 readTestImpl2(rb,
false, capacity, capacity, 0);
397 writeTestImpl(rb, capacity, capacity, 0);
400 readTestImpl(rb,
false, capacity, capacity, 0);
406 writeTestImpl(rb, capacity, capacity, 0);
409 readTestImpl2(rb,
false, capacity, capacity, 0);
415 std::vector<TrivialType> source = createIntArray(capacity, 0);
422 readTestImpl(rb,
false, capacity, 5, 0);
429 readTestImpl(rb,
false, capacity, capacity, 0);
435 std::vector<TrivialType> source = createIntArray(capacity, 0);
442 moveGetPutImpl(rb, 5);
443 readTestImpl(rb,
false, capacity, 5, 5);
450 readTestImpl(rb,
false, capacity, capacity, 0);
458 jau::nsize_t grownCapacity = initialCapacity+growAmount;
459 std::vector<TrivialType> source = createIntArray(initialCapacity, 0);
472 moveGetPutImpl(rb, pos);
513 test_GrowFullImpl(11, 0);
516 test_GrowFullImpl(11, 0+1);
519 test_GrowFullImpl(11, 0+2);
522 test_GrowFullImpl(11, 0+3);
525 test_GrowFullImpl(11, 11-1);
528 test_GrowFullImpl(11, 11-1-1);
531 test_GrowFullImpl(11, 11-1-2);
534 test_GrowFullImpl(11, 11-1-3);