09e89db82f
Change package, artifact group, artifact name, and Gradle module name to kotlin-metadata and kotlin-metadata-jvm, respectively. In Kotlin 2.0, kotlin-metadata-jvm library is promoted to stable, and is a part of Kotlin distribution now. Note that kotlinx-metadata-klib is left with org.jetbrains.kotlinx group, artifact name and package because -klib part is considered not stable and for internal use. Since it is still published via Sonatype, it should have kotlinx group. Therefore, it will have both classes from kotlin.metadata and kotlinx.metadata packages. This is not a problem, because we already had kotlinx.metadata split package between -jvm and -klib before. #KT-63219 Fixed
37 lines
1.1 KiB
Kotlin
37 lines
1.1 KiB
Kotlin
/*
|
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
*/
|
|
|
|
package kotlin.metadata.test
|
|
|
|
import kotlin.metadata.jvm.JvmMetadataVersion
|
|
import kotlin.test.*
|
|
|
|
class JvmMetadataVersionTest {
|
|
|
|
fun mv(major: Int, minor: Int, patch: Int) = JvmMetadataVersion(major, minor, patch)
|
|
|
|
@Test
|
|
fun testEquality() {
|
|
assertEquals(mv(1, 2, 3), mv(1, 2, 3))
|
|
assertNotEquals(mv(0, 2, 3), mv(1, 2, 3))
|
|
assertNotEquals(mv(1, 0, 3), mv(1, 2, 3))
|
|
assertNotEquals(mv(1, 2, 3), mv(1, 2, 0))
|
|
}
|
|
|
|
@Test
|
|
fun testComparison() {
|
|
assertTrue(mv(1, 2, 3) > mv(1, 2, 0))
|
|
assertTrue(mv(1, 0, 3) < mv(1, 2, 0))
|
|
assertTrue(mv(1, 2, 3) < mv(2, 0, 0))
|
|
}
|
|
|
|
@Test
|
|
fun testConstructor() {
|
|
assertFailsWith<IllegalArgumentException> { mv(-1, 0, 0) }
|
|
assertFailsWith<IllegalArgumentException> { mv(0, -1, 0) }
|
|
assertFailsWith<IllegalArgumentException> { mv(0, 0, -1) }
|
|
}
|
|
}
|