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.
This commit is contained in:
1 parent
904d1ffbea
commit
9ca122a734
5 files changed
+5
-5
No files matched your search
+1
-1
@@ -109,7 +109,7 @@ class AprsBeaconTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `an over-long comment is trimmed to keep the line legal`() {
|
fun `an over-long comment is trimmed to keep the line legal`() {
|
||||||
val text = line(comment = "x".repeat(600))
|
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. */
|
/** The comment limit for this format is 43 characters. */
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ class AprsLoginTest {
|
|||||||
* every send afterwards reported success against a server that had refused the login.
|
* every send afterwards reported success against a server that had refused the login.
|
||||||
*/
|
*/
|
||||||
@Test
|
@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(
|
val outcome = AprsLogin.parse(
|
||||||
"# Invalid login: software name and version are not separated by a space"
|
"# Invalid login: software name and version are not separated by a space"
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ class CwDetectionPoolTest {
|
|||||||
var phase = 0
|
var phase = 0
|
||||||
repeat(4) {
|
repeat(4) {
|
||||||
pool.add(FloatArray(320) { i ->
|
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
|
phase += 320
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ class CwShiftDeciderTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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
|
// 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
|
// against the previous estimate would never fire. Anchored, the shift updates
|
||||||
// once the accumulated move clears the margin.
|
// once the accumulated move clears the margin.
|
||||||
|
|||||||
+1
-1
@@ -121,7 +121,7 @@ class CwToneShifterTest {
|
|||||||
* nothing arrives at — and nothing else in the build would object.
|
* nothing arrives at — and nothing else in the build would object.
|
||||||
*/
|
*/
|
||||||
@Test
|
@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(
|
assertTrue(
|
||||||
CwToneShifter.isInsideWindow(CwToneShifter.TARGET_HZ.toFloat()),
|
CwToneShifter.isInsideWindow(CwToneShifter.TARGET_HZ.toFloat()),
|
||||||
"TARGET_HZ ${CwToneShifter.TARGET_HZ} is outside the model window " +
|
"TARGET_HZ ${CwToneShifter.TARGET_HZ} is outside the model window " +
|
||||||
|
|||||||
Reference in new issue
Block a user