@@ -317,4 +317,48 @@ SUITE(SparkProtocolConstruction)
317317 spark_protocol.send_event (" lake-depth/1" , " 28m" , 21600 , EventType::PRIVATE);
318318 CHECK_ARRAY_EQUAL (expected, sent_buf_0, 34 );
319319 }
320+
321+ TEST_FIXTURE (ConstructorFixture, PublishingBurst4EventsSucceeds)
322+ {
323+ bool success[4 ];
324+ next_millis = 1000 ;
325+ success[0 ] = spark_protocol.send_event (" a" , NULL , 60 , EventType::PUBLIC);
326+ success[1 ] = spark_protocol.send_event (" b" , NULL , 60 , EventType::PUBLIC);
327+ success[2 ] = spark_protocol.send_event (" c" , NULL , 60 , EventType::PUBLIC);
328+ success[3 ] = spark_protocol.send_event (" d" , NULL , 60 , EventType::PUBLIC);
329+ CHECK (success[0 ] && success[1 ] && success[2 ] && success[3 ]);
330+ }
331+
332+ TEST_FIXTURE (ConstructorFixture, PublishingBurst5EventsFails)
333+ {
334+ bool success[5 ];
335+ next_millis = 2000 ;
336+ success[0 ] = spark_protocol.send_event (" a" , NULL , 60 , EventType::PUBLIC);
337+ success[1 ] = spark_protocol.send_event (" b" , NULL , 60 , EventType::PUBLIC);
338+ success[2 ] = spark_protocol.send_event (" c" , NULL , 60 , EventType::PUBLIC);
339+ success[3 ] = spark_protocol.send_event (" d" , NULL , 60 , EventType::PUBLIC);
340+ success[4 ] = spark_protocol.send_event (" e" , NULL , 60 , EventType::PUBLIC);
341+ CHECK (success[0 ] && success[1 ] && success[2 ] && success[3 ] && !success[4 ]);
342+ }
343+
344+ TEST_FIXTURE (ConstructorFixture, PublishingBurst4Wait1SBurst4AgainSucceeds)
345+ {
346+ bool success[4 ];
347+
348+ next_millis = 3000 ;
349+ success[0 ] = spark_protocol.send_event (" a" , NULL , 60 , EventType::PUBLIC);
350+ success[1 ] = spark_protocol.send_event (" b" , NULL , 60 , EventType::PUBLIC);
351+ success[2 ] = spark_protocol.send_event (" c" , NULL , 60 , EventType::PUBLIC);
352+ success[3 ] = spark_protocol.send_event (" d" , NULL , 60 , EventType::PUBLIC);
353+ bool first_burst_success = success[0 ] && success[1 ] && success[2 ] && success[3 ];
354+
355+ next_millis = 4000 ;
356+ success[0 ] = spark_protocol.send_event (" a" , NULL , 60 , EventType::PUBLIC);
357+ success[1 ] = spark_protocol.send_event (" b" , NULL , 60 , EventType::PUBLIC);
358+ success[2 ] = spark_protocol.send_event (" c" , NULL , 60 , EventType::PUBLIC);
359+ success[3 ] = spark_protocol.send_event (" d" , NULL , 60 , EventType::PUBLIC);
360+ bool second_burst_success = success[0 ] && success[1 ] && success[2 ] && success[3 ];
361+
362+ CHECK (first_burst_success && second_burst_success);
363+ }
320364}
0 commit comments