From 9ca122a734fa2be6b7571045848ada72771a3c86 Mon Sep 17 00:00:00 2001 From: MCKero Date: Sun, 27 Sep 2026 10:54:16 +0100 Subject: [PATCH] test(kmp): make commonTest sources compile on kotlin/native With the main source sets now compiling on both platforms the native test compilation finally ran, and it rejected a handful of test-side forms the jvm toolchain silently accepts. Backtick test names are mapped onto native symbols, where a comma is an illegal character, so three names drop the comma; the wording keeps the same meaning. java.lang.Math.PI has no common analogue and becomes kotlin.math.PI, matching the already-qualified kotlin.math.sin call on the same line. String.toByteArray() is jvm-only, and the byte-length assertion for the APRS line budget switches to encodeToByteArray(), the same replacement the production sources went through. --- .../com/rtbishop/look4sat/core/domain/aprs/AprsBeaconTest.kt | 2 +- .../com/rtbishop/look4sat/core/domain/aprs/AprsLoginTest.kt | 2 +- .../com/rtbishop/look4sat/core/domain/cw/CwDetectionPoolTest.kt | 2 +- .../com/rtbishop/look4sat/core/domain/cw/CwShiftDeciderTest.kt | 2 +- .../com/rtbishop/look4sat/core/domain/cw/CwToneShifterTest.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsBeaconTest.kt b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsBeaconTest.kt index 0dd092fd..2f28137d 100644 --- a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsBeaconTest.kt +++ b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsBeaconTest.kt @@ -109,7 +109,7 @@ class AprsBeaconTest { @Test fun `an over-long comment is trimmed to keep the line legal`() { val text = line(comment = "x".repeat(600)) - assertTrue(text.toByteArray().size + 2 <= 512, "line was ${text.toByteArray().size} bytes") + assertTrue(text.encodeToByteArray().size + 2 <= 512, "line was ${text.encodeToByteArray().size} bytes") } /** The comment limit for this format is 43 characters. */ diff --git a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsLoginTest.kt b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsLoginTest.kt index 5feb14d0..b27e0ae2 100644 --- a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsLoginTest.kt +++ b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/aprs/AprsLoginTest.kt @@ -84,7 +84,7 @@ class AprsLoginTest { * every send afterwards reported success against a server that had refused the login. */ @Test - fun `an invalid login comment is a refusal, not chatter`() { + fun `an invalid login comment is a refusal rather than chatter`() { val outcome = AprsLogin.parse( "# Invalid login: software name and version are not separated by a space" ) diff --git a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwDetectionPoolTest.kt b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwDetectionPoolTest.kt index 4358823b..3b47f1f7 100644 --- a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwDetectionPoolTest.kt +++ b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwDetectionPoolTest.kt @@ -156,7 +156,7 @@ class CwDetectionPoolTest { var phase = 0 repeat(4) { pool.add(FloatArray(320) { i -> - kotlin.math.sin(2.0 * Math.PI * 1500.0 * (phase + i) / sampleRate).toFloat() + kotlin.math.sin(2.0 * kotlin.math.PI * 1500.0 * (phase + i) / sampleRate).toFloat() }) phase += 320 } diff --git a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwShiftDeciderTest.kt b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwShiftDeciderTest.kt index 4c988e75..f0f95691 100644 --- a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwShiftDeciderTest.kt +++ b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwShiftDeciderTest.kt @@ -132,7 +132,7 @@ class CwShiftDeciderTest { } @Test - fun `hysteresis is measured against the anchor, not the previous estimate`() { + fun `hysteresis is measured against the anchor rather than the previous estimate`() { // Walk in 25 Hz steps: each step is under the 40 Hz margin, so a comparison // against the previous estimate would never fire. Anchored, the shift updates // once the accumulated move clears the margin. diff --git a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwToneShifterTest.kt b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwToneShifterTest.kt index ac42834c..5e2fa6ca 100644 --- a/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwToneShifterTest.kt +++ b/core/domain/src/commonTest/kotlin/com/rtbishop/look4sat/core/domain/cw/CwToneShifterTest.kt @@ -121,7 +121,7 @@ class CwToneShifterTest { * nothing arrives at — and nothing else in the build would object. */ @Test - fun `the shift target sits inside the model window, clear of its edges`() { + fun `the shift target sits inside the model window and clear of its edges`() { assertTrue( CwToneShifter.isInsideWindow(CwToneShifter.TARGET_HZ.toFloat()), "TARGET_HZ ${CwToneShifter.TARGET_HZ} is outside the model window " +