From be60eaa12035269e0fc8ba723c8a65b969d34113 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 19 Nov 2016 19:48:16 +0800 Subject: [PATCH] Added a test for pointer continuity over a submit. Which fails. --- .../Clock SignalTests/ArrayBuilderTests.mm | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm b/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm index ce7ce159c..a2ff011e4 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 %lu", (unsigned long)inputData.length); - XCTAssert(outputData.length == outputSize, @"Output data should be 3 bytes long, was %lu", (unsigned long)outputData.length); + XCTAssert(inputData.length == inputSize, @"Input data should be %lu bytes long, was %lu", inputSize, (unsigned long)inputData.length); + XCTAssert(outputData.length == outputSize, @"Output data should be %lu bytes long, was %lu", outputSize, (unsigned long)outputData.length); uint8_t *input = (uint8_t *)inputData.bytes; uint8_t *output = (uint8_t *)outputData.bytes; @@ -102,4 +102,27 @@ static void setData(bool is_input, uint8_t *data, size_t size) XCTAssert(outputData.length == 9, @"All output data should have been received; %lu bytes were received", (unsigned long)outputData.length); } +- (void)testSubmitContinuity +{ + Outputs::CRT::ArrayBuilder arrayBuilder(200, 100, setData); + + arrayBuilder.get_input_storage(5); + arrayBuilder.get_output_storage(5); + + arrayBuilder.flush(); + + uint8_t *input = arrayBuilder.get_input_storage(5); + uint8_t *output = arrayBuilder.get_output_storage(5); + + arrayBuilder.submit(); + + for(int c = 0; c < 5; c++) input[c] = c; + for(int c = 0; c < 5; c++) output[c] = c + 0x80; + + arrayBuilder.flush(); + arrayBuilder.submit(); + + [self assertMonotonicForInputSize:5 outputSize:5]; +} + @end