diff --git a/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm b/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm index 983feca4b..ce7ce159c 100644 --- a/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm +++ b/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm @@ -30,8 +30,8 @@ static void setData(bool is_input, uint8_t *data, size_t size) XCTAssert(inputData != nil, @"Should have received some input data"); XCTAssert(outputData != nil, @"Should have received some output data"); - XCTAssert(inputData.length == inputSize, @"Input data should be 5 bytes long, was %d", inputData.length); - XCTAssert(outputData.length == outputSize, @"Output data should be 3 bytes long, was %d", outputData.length); + XCTAssert(inputData.length == inputSize, @"Input data should be 5 bytes long, was %lu", (unsigned long)inputData.length); + XCTAssert(outputData.length == outputSize, @"Output data should be 3 bytes long, was %lu", (unsigned long)outputData.length); uint8_t *input = (uint8_t *)inputData.bytes; uint8_t *output = (uint8_t *)outputData.bytes; @@ -80,4 +80,26 @@ static void setData(bool is_input, uint8_t *data, size_t size) [self assertMonotonicForInputSize:4 outputSize:4]; } +- (void)testSubmitWithoutFlush +{ + Outputs::CRT::ArrayBuilder arrayBuilder(200, 100, setData); + + arrayBuilder.get_input_storage(5); + arrayBuilder.get_input_storage(8); + arrayBuilder.get_output_storage(6); + arrayBuilder.get_input_storage(12); + arrayBuilder.get_output_storage(3); + + arrayBuilder.submit(); + + XCTAssert(inputData.length == 0, @"No input data should have been received; %lu bytes were received", (unsigned long)inputData.length); + XCTAssert(outputData.length == 0, @"No output data should have been received; %lu bytes were received", (unsigned long)outputData.length); + + arrayBuilder.flush(); + arrayBuilder.submit(); + + XCTAssert(inputData.length == 25, @"All input data should have been received; %lu bytes were received", (unsigned long)inputData.length); + XCTAssert(outputData.length == 9, @"All output data should have been received; %lu bytes were received", (unsigned long)outputData.length); +} + @end