#include "naut/pipeline.h" #include "test.h" int main(void) { naut_pipeline pipeline; naut_pipeline_init(&pipeline, NAUT_BLOCK, 4, 1024, 32); CHECK_EQ(naut_pipeline_depth(&pipeline), 32); /* 16 KiB every 100 us with 20 ms RTT is about 164 MB/s and a 200-block * BDP. Repeated samples should grow the window substantially. */ double now = 1.0; for (int i = 0; i < 100; i++) { now += 0.0001; naut_pipeline_on_block(&pipeline, NAUT_BLOCK, now - 0.020, now); } CHECK(naut_pipeline_depth(&pipeline) > 128); CHECK(naut_pipeline_depth(&pipeline) <= 1024); uint32_t high = naut_pipeline_depth(&pipeline); for (int i = 0; i < 100; i++) { now += 0.050; naut_pipeline_on_block(&pipeline, NAUT_BLOCK, now - 0.005, now); } CHECK(naut_pipeline_depth(&pipeline) < high); CHECK(naut_pipeline_depth(&pipeline) >= 4); naut_pipeline_init(&pipeline, 0, 0, 0, 0); CHECK_EQ(naut_pipeline_depth(&pipeline), 1); TEST_MAIN_END(); }