From 291aa42fe1d439581ecf7b1eeb4babbaeb31f509 Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Sat, 19 Sep 2020 21:20:37 -0400
Subject: [PATCH] Corrects test target.

---
 .../Mac/Clock Signal.xcodeproj/project.pbxproj     |  2 ++
 .../PCMSegmentEventSourceTests.mm                  | 14 ++++----------
 OSBindings/Mac/Clock SignalTests/PCMTrackTests.mm  |  8 +++-----
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj
index c4c11eb2c..b86a62c7d 100644
--- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj	
+++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj	
@@ -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;
 		};
diff --git a/OSBindings/Mac/Clock SignalTests/PCMSegmentEventSourceTests.mm b/OSBindings/Mac/Clock SignalTests/PCMSegmentEventSourceTests.mm
index 6eca9d231..38d9ac14d 100644
--- a/OSBindings/Mac/Clock SignalTests/PCMSegmentEventSourceTests.mm	
+++ b/OSBindings/Mac/Clock SignalTests/PCMSegmentEventSourceTests.mm	
@@ -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();
diff --git a/OSBindings/Mac/Clock SignalTests/PCMTrackTests.mm b/OSBindings/Mac/Clock SignalTests/PCMTrackTests.mm
index fd3c5bfee..d20e87477 100644
--- a/OSBindings/Mac/Clock SignalTests/PCMTrackTests.mm	
+++ b/OSBindings/Mac/Clock SignalTests/PCMTrackTests.mm	
@@ -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>();