diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 52dbe76d7..cf183ae97 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -150,7 +150,6 @@ 4B2A332D1DB86821002876E3 /* OricOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B2A332B1DB86821002876E3 /* OricOptions.xib */; }; 4B2A539F1D117D36003C6002 /* CSAudioQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A53911D117D36003C6002 /* CSAudioQueue.m */; }; 4B2A53A01D117D36003C6002 /* CSMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A53961D117D36003C6002 /* CSMachine.mm */; }; - 4B2AF8691E513FC20027EE29 /* TIATests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2AF8681E513FC20027EE29 /* TIATests.mm */; }; 4B2B3A4B1F9B8FA70062DABF /* Typer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2B3A471F9B8FA70062DABF /* Typer.cpp */; }; 4B2B3A4C1F9B8FA70062DABF /* MemoryFuzzer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2B3A481F9B8FA70062DABF /* MemoryFuzzer.cpp */; }; 4B2BFC5F1D613E0200BA3AA9 /* TapePRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2BFC5D1D613E0200BA3AA9 /* TapePRG.cpp */; }; @@ -198,7 +197,6 @@ 4B4B1A3D200198CA00A0F866 /* KonamiSCC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4B1A3A200198C900A0F866 /* KonamiSCC.cpp */; }; 4B4DC8211D2C2425003C5BF8 /* Vic20.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DC81F1D2C2425003C5BF8 /* Vic20.cpp */; }; 4B4DC82B1D2C27A4003C5BF8 /* SerialBus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DC8291D2C27A4003C5BF8 /* SerialBus.cpp */; }; - 4B50730A1DDFCFDF00C48FBD /* ArrayBuilderTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B5073091DDFCFDF00C48FBD /* ArrayBuilderTests.mm */; }; 4B54C0BC1F8D8E790050900F /* KeyboardMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0BB1F8D8E790050900F /* KeyboardMachine.cpp */; }; 4B54C0BF1F8D8F450050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0BD1F8D8F450050900F /* Keyboard.cpp */; }; 4B54C0C21F8D91CD0050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C11F8D91CD0050900F /* Keyboard.cpp */; }; @@ -871,7 +869,6 @@ 4B4DC8271D2C2470003C5BF8 /* C1540.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = C1540.hpp; sourceTree = ""; }; 4B4DC8291D2C27A4003C5BF8 /* SerialBus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerialBus.cpp; sourceTree = ""; }; 4B4DC82A1D2C27A4003C5BF8 /* SerialBus.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SerialBus.hpp; sourceTree = ""; }; - 4B5073091DDFCFDF00C48FBD /* ArrayBuilderTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ArrayBuilderTests.mm; sourceTree = ""; }; 4B51F70920A521D700AFA2C1 /* Source.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Source.hpp; sourceTree = ""; }; 4B51F70A20A521D700AFA2C1 /* Observer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Observer.hpp; sourceTree = ""; }; 4B54C0BB1F8D8E790050900F /* KeyboardMachine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardMachine.cpp; sourceTree = ""; }; @@ -2823,7 +2820,6 @@ 4BB73EB51B587A5100552FC2 /* Clock SignalTests */ = { isa = PBXGroup; children = ( - 4B5073091DDFCFDF00C48FBD /* ArrayBuilderTests.mm */, 4B924E981E74D22700B76AF1 /* AtariStaticAnalyserTests.mm */, 4BB2A9AE1E13367E001A5C23 /* CRCTests.mm */, 4BA91E1C216D85BA00F79557 /* MasterSystemVDPTests.mm */, @@ -4017,9 +4013,7 @@ 4B7BC7F51F58F27800D1B1B4 /* 6502AllRAM.cpp in Sources */, 4B08A2751EE35D56008B7065 /* Z80InterruptTests.swift in Sources */, 4BFCA1241ECBDCB400AC40C1 /* AllRAMProcessor.cpp in Sources */, - 4B50730A1DDFCFDF00C48FBD /* ArrayBuilderTests.mm in Sources */, 4BBF49AF1ED2880200AB3669 /* FUSETests.swift in Sources */, - 4B2AF8691E513FC20027EE29 /* TIATests.mm in Sources */, 4B3BA0CE1D318B44005DD7A7 /* C1540Bridge.mm in Sources */, 4B3BA0D11D318B44005DD7A7 /* TestMachine6502.mm in Sources */, 4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */, diff --git a/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm b/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm deleted file mode 100644 index 8303a0cb3..000000000 --- a/OSBindings/Mac/Clock SignalTests/ArrayBuilderTests.mm +++ /dev/null @@ -1,140 +0,0 @@ -// -// ArrayBuilderTests.m -// Clock Signal -// -// Created by Thomas Harte on 19/11/2016. -// Copyright 2016 Thomas Harte. All rights reserved. -// - -#import - -#include "ArrayBuilder.hpp" - -static NSData *inputData, *outputData; - -static void setData(bool is_input, uint8_t *data, size_t size) -{ - NSData *dataObject = [NSData dataWithBytes:data length:size]; - if(is_input) inputData = dataObject; else outputData = dataObject; -} - -@interface ArrayBuilderTests : XCTestCase -@end - -@implementation ArrayBuilderTests - -+ (void)setUp -{ - inputData = nil; - outputData = nil; -} - -- (void)assertMonotonicForInputSize:(size_t)inputSize outputSize:(size_t)outputSize -{ - 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 %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); - - if(inputData.length == inputSize && outputData.length == outputSize) - { - uint8_t *input = (uint8_t *)inputData.bytes; - uint8_t *output = (uint8_t *)outputData.bytes; - - for(int c = 0; c < inputSize; c++) XCTAssert(input[c] == c, @"Input item %d should be %d, was %d", c, c, input[c]); - for(int c = 0; c < outputSize; c++) XCTAssert(output[c] == c + 0x80, @"Output item %d should be %d, was %d", c, c+0x80, output[c]); - } -} - -- (std::function)emptyFlushFunction -{ - return [=] (uint8_t *input, size_t input_size, uint8_t *output, size_t output_size) {}; -} - -- (void)testSingleWriteSingleFlush -{ - Outputs::CRT::ArrayBuilder arrayBuilder(200, 100, setData); - - uint8_t *input = arrayBuilder.get_input_storage(5); - uint8_t *output = arrayBuilder.get_output_storage(3); - - for(int c = 0; c < 5; c++) input[c] = c; - for(int c = 0; c < 3; c++) output[c] = c + 0x80; - - arrayBuilder.flush(self.emptyFlushFunction); - arrayBuilder.submit(); - - [self assertMonotonicForInputSize:5 outputSize:3]; -} - -- (void)testDoubleWriteSingleFlush -{ - Outputs::CRT::ArrayBuilder arrayBuilder(200, 100, setData); - uint8_t *input; - uint8_t *output; - - input = arrayBuilder.get_input_storage(2); - output = arrayBuilder.get_output_storage(2); - - for(int c = 0; c < 2; c++) input[c] = c; - for(int c = 0; c < 2; c++) output[c] = c + 0x80; - - input = arrayBuilder.get_input_storage(2); - output = arrayBuilder.get_output_storage(2); - - for(int c = 0; c < 2; c++) input[c] = c+2; - for(int c = 0; c < 2; c++) output[c] = c+2 + 0x80; - - arrayBuilder.flush(self.emptyFlushFunction); - arrayBuilder.submit(); - - [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(self.emptyFlushFunction); - 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); -} - -- (void)testSubmitContinuity -{ - Outputs::CRT::ArrayBuilder arrayBuilder(200, 100, setData); - - arrayBuilder.get_input_storage(5); - arrayBuilder.get_output_storage(5); - - arrayBuilder.flush(self.emptyFlushFunction); - - 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(self.emptyFlushFunction); - arrayBuilder.submit(); - - [self assertMonotonicForInputSize:5 outputSize:5]; -} - -@end