1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Corrects test target.

This commit is contained in:
Thomas Harte 2020-09-19 21:20:37 -04:00
parent e807a462a1
commit 291aa42fe1
3 changed files with 9 additions and 15 deletions

View File

@ -860,6 +860,7 @@
4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */; };
4BF437EE209D0F7E008CBD6B /* SegmentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF437EC209D0F7E008CBD6B /* SegmentParser.cpp */; };
4BF437EF209D0F7E008CBD6B /* SegmentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF437EC209D0F7E008CBD6B /* SegmentParser.cpp */; };
4BF8D4C82516E27A00BBE21B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB8617024E22F4900A00E03 /* Accelerate.framework */; };
4BFCA1241ECBDCB400AC40C1 /* AllRAMProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1211ECBDCAF00AC40C1 /* AllRAMProcessor.cpp */; };
4BFCA1271ECBE33200AC40C1 /* TestMachineZ80.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1261ECBE33200AC40C1 /* TestMachineZ80.mm */; };
4BFCA1291ECBE7A700AC40C1 /* zexall.com in Resources */ = {isa = PBXBuildFile; fileRef = 4BFCA1281ECBE7A700AC40C1 /* zexall.com */; };
@ -1830,6 +1831,7 @@
buildActionMask = 2147483647;
files = (
4B9F11CA2272433900701480 /* libz.tbd in Frameworks */,
4BF8D4C82516E27A00BBE21B /* Accelerate.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -70,12 +70,9 @@
- (void)testSeekToSecondBit {
Storage::Disk::PCMSegmentEventSource segmentSource = self.segmentSource;
Storage::Time target_time(1, 10);
Storage::Time found_time = segmentSource.seek_to(target_time);
found_time.simplify();
XCTAssertTrue(found_time.length == 1 && found_time.clock_rate == 20, @"A request to seek to 1/10th should have seeked to 1/20th");
const float found_time = segmentSource.seek_to(1.0f / 10.0f);
XCTAssertTrue(fabsf(found_time - 1.0f / 20.0f) < 0.01f, @"A request to seek to 1/10th should have seeked to 1/20th");
Storage::Disk::Track::Event next_event = segmentSource.get_next_event();
next_event.length.simplify();
@ -85,12 +82,9 @@
- (void)testSeekBeyondFinalBit {
Storage::Disk::PCMSegmentEventSource segmentSource = self.segmentSource;
Storage::Time target_time(24, 10);
const float found_time = segmentSource.seek_to(2.4f);
Storage::Time found_time = segmentSource.seek_to(target_time);
found_time.simplify();
XCTAssertTrue(found_time.length == 47 && found_time.clock_rate == 20, @"A request to seek to 24/10ths should have seeked to 47/20ths");
XCTAssertTrue(fabsf(found_time - 47.0f / 20.0f) < 0.01f, @"A request to seek to 24/10ths should have seeked to 47/20ths");
Storage::Disk::Track::Event next_event = segmentSource.get_next_event();
next_event.length.simplify();

View File

@ -73,16 +73,14 @@
}
Storage::Disk::PCMTrack track(segments);
Storage::Time late_time(967445, 2045454);
const float late_time = 967445.0f / 2045454.0f;
const auto offset = track.seek_to(late_time);
XCTAssert(offset <= late_time, "Found location should be at or before sought time");
const auto difference = late_time - offset;
const double difference_duration = difference.get<double>();
XCTAssert(difference_duration >= 0.0 && difference_duration < 0.005, "Next event should occur soon");
XCTAssert(difference >= 0.0 && difference < 0.005, "Next event should occur soon");
const double offset_duration = offset.get<double>();
XCTAssert(offset_duration >= 0.0 && offset_duration < 0.5, "Next event should occur soon");
XCTAssert(offset >= 0.0 && offset < 0.5, "Next event should occur soon");
auto next_event = track.get_next_event();
double next_event_duration = next_event.length.get<double>();