From b02da5f49dd4258c23dd6bee923a43ef6ee9e35e Mon Sep 17 00:00:00 2001 From: Kazik Pogoda Date: Sun, 24 Sep 2023 17:46:29 +0200 Subject: [PATCH] OscSpecification: test and examples separated --- .../kotlin/OscSpecificationExamples.kt | 49 +++++++++++++++++++ .../commonTest/kotlin/OscSpecificationTest.kt | 25 ---------- .../src/jvmMain/kotlin/JvmUdpOscTransport.kt | 27 ---------- 3 files changed, 49 insertions(+), 52 deletions(-) create mode 100644 xemantic-osc-api/src/commonTest/kotlin/OscSpecificationExamples.kt delete mode 100644 xemantic-osc-udp/src/jvmMain/kotlin/JvmUdpOscTransport.kt diff --git a/xemantic-osc-api/src/commonTest/kotlin/OscSpecificationExamples.kt b/xemantic-osc-api/src/commonTest/kotlin/OscSpecificationExamples.kt new file mode 100644 index 0000000..16ee032 --- /dev/null +++ b/xemantic-osc-api/src/commonTest/kotlin/OscSpecificationExamples.kt @@ -0,0 +1,49 @@ +/* + * xemantic-osc - Kotlin idiomatic and multiplatform OSC protocol support + * Copyright (C) 2023 Kazimierz Pogoda + * + * This file is part of xemantic-osc. + * + * xemantic-osc is free software: you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * xemantic-osc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with xemantic-osc. + * If not, see . + */ + +package com.xemantic.osc + +/** + * See [Osc Message Examples](https://opensoundcontrol.stanford.edu/spec-1_0-examples.html). + */ +val oscillator4FrequencyBytes = ubyteArrayOf( + 0x2fu, 0x6fu, 0x73u, 0x63u, + 0x69u, 0x6cu, 0x6cu, 0x61u, + 0x74u, 0x6fu, 0x72u, 0x2fu, + 0x34u, 0x2fu, 0x66u, 0x72u, + 0x65u, 0x71u, 0x75u, 0x65u, + 0x6eu, 0x63u, 0x79u, 0x00u, + 0x2cu, 0x66u, 0x00u, 0x00u, + 0x43u, 0xdcu, 0x00u, 0x00u +).asByteArray() + +/** + * See [Osc Message Examples](https://opensoundcontrol.stanford.edu/spec-1_0-examples.html). + */ +val fooBytes = ubyteArrayOf( + 0x2fu, 0x66u, 0x6fu, 0x6fu, + 0x00u, 0x00u, 0x00u, 0x00u, + 0x2cu, 0x69u, 0x69u, 0x73u, + 0x66u, 0x66u, 0x00u, 0x00u, + 0x00u, 0x00u, 0x03u, 0xe8u, + 0xffu, 0xffu, 0xffu, 0xffu, + 0x68u, 0x65u, 0x6cu, 0x6cu, + 0x6fu, 0x00u, 0x00u, 0x00u, + 0x3fu, 0x9du, 0xf3u, 0xb6u, + 0x40u, 0xb5u, 0xb2u, 0x2du +).asByteArray() diff --git a/xemantic-osc-api/src/commonTest/kotlin/OscSpecificationTest.kt b/xemantic-osc-api/src/commonTest/kotlin/OscSpecificationTest.kt index 4350434..2b5bafa 100644 --- a/xemantic-osc-api/src/commonTest/kotlin/OscSpecificationTest.kt +++ b/xemantic-osc-api/src/commonTest/kotlin/OscSpecificationTest.kt @@ -31,31 +31,6 @@ import kotlin.test.Test */ class OscSpecificationTest { - // given - private val oscillator4FrequencyBytes = ubyteArrayOf( - 0x2fu, 0x6fu, 0x73u, 0x63u, - 0x69u, 0x6cu, 0x6cu, 0x61u, - 0x74u, 0x6fu, 0x72u, 0x2fu, - 0x34u, 0x2fu, 0x66u, 0x72u, - 0x65u, 0x71u, 0x75u, 0x65u, - 0x6eu, 0x63u, 0x79u, 0x00u, - 0x2cu, 0x66u, 0x00u, 0x00u, - 0x43u, 0xdcu, 0x00u, 0x00u - ).asByteArray() - - private val fooBytes = ubyteArrayOf( - 0x2fu, 0x66u, 0x6fu, 0x6fu, - 0x00u, 0x00u, 0x00u, 0x00u, - 0x2cu, 0x69u, 0x69u, 0x73u, - 0x66u, 0x66u, 0x00u, 0x00u, - 0x00u, 0x00u, 0x03u, 0xe8u, - 0xffu, 0xffu, 0xffu, 0xffu, - 0x68u, 0x65u, 0x6cu, 0x6cu, - 0x6fu, 0x00u, 0x00u, 0x00u, - 0x3fu, 0x9du, 0xf3u, 0xb6u, - 0x40u, 0xb5u, 0xb2u, 0x2du - ).asByteArray() - data class Foo( val firstInt: Int = 1000, val secondInt: Int = -1, diff --git a/xemantic-osc-udp/src/jvmMain/kotlin/JvmUdpOscTransport.kt b/xemantic-osc-udp/src/jvmMain/kotlin/JvmUdpOscTransport.kt deleted file mode 100644 index 045d96a..0000000 --- a/xemantic-osc-udp/src/jvmMain/kotlin/JvmUdpOscTransport.kt +++ /dev/null @@ -1,27 +0,0 @@ -import com.xemantic.osc.OscInput -import kotlinx.coroutines.Dispatchers - -/* - * xemantic-osc - Kotlin idiomatic and multiplatform OSC protocol support - * Copyright (C) 2023 Kazimierz Pogoda - * - * This file is part of xemantic-osc. - * - * xemantic-osc is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * xemantic-osc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with xemantic-osc. - * If not, see . - */ - -//actual fun platformUdpOscTransport( -// input: OscInput = OscInput(), -//): UdpOscTransport = UdpOscTransport( -// input, -// dispatcher = Dispatchers.IO -//)