Skip to content

Commit 4849500

Browse files
committed
0.9.9.1-11
vars-interface bug, missing `operator` modifier
1 parent c5a0b38 commit 4849500

File tree

7 files changed

+78
-6
lines changed

7 files changed

+78
-6
lines changed

settings.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ pluginManagement {
1010

1111
gradle.rootProject {
1212
group = "kotlin.graphics"
13-
version = "0.9.9.1-10"
13+
version = "0.9.9.1-11"
1414
}

src/main/kotlin/glm_/glm.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ val GLM_VERSION_MAJOR = 0
164164
val GLM_VERSION_MINOR = 9
165165
val GLM_VERSION_PATCH = 9
166166
val GLM_VERSION_REVISION = 1
167-
val GLM_VERSION_BUILD = 10
167+
val GLM_VERSION_BUILD = 11
168168
val GLM_VERSION = GLM_VERSION_MAJOR * 1_000 + GLM_VERSION_MINOR * 100 + GLM_VERSION_PATCH * 10 + GLM_VERSION_REVISION
169169

170170
/*

src/main/kotlin/glm_/vec1/Vec1Vars.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package glm_.vec1
33
interface Vec1Vars<T : Number> {
44
var x: T
55

6-
fun component1() = x
6+
operator fun component1() = x
77

88

99
// -- Component accesses --

src/main/kotlin/glm_/vec2/Vec2Vars.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import glm_.vec1.Vec1Vars
55
interface Vec2Vars<T : Number> : Vec1Vars<T> {
66
var y: T
77

8-
fun component2() = y
8+
operator fun component2() = y
99

1010

1111
// -- Component accesses --

src/main/kotlin/glm_/vec3/Vec3Vars.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import glm_.vec2.Vec2Vars
55
interface Vec3Vars<T : Number> : Vec2Vars<T> {
66
var z: T
77

8-
fun component3() = z
8+
operator fun component3() = z
99

1010

1111
// -- Component accesses --

src/main/kotlin/glm_/vec4/Vec4Vars.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import glm_.vec3.Vec3Vars
55
interface Vec4Vars<T : Number> : Vec3Vars<T> {
66
var w: T
77

8-
fun component4() = w
8+
operator fun component4() = w
99

1010

1111
// -- Component accesses --
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package glm_
2+
3+
import glm_.vec1.Vec1
4+
import glm_.vec1.Vec1i
5+
import glm_.vec2.Vec2
6+
import glm_.vec2.Vec2i
7+
import glm_.vec3.Vec3
8+
import glm_.vec3.Vec3i
9+
import glm_.vec4.Vec4
10+
import glm_.vec4.Vec4i
11+
import io.kotest.core.spec.style.StringSpec
12+
import io.kotest.matchers.shouldBe
13+
14+
15+
class testVectorComponent : StringSpec() {
16+
17+
init {
18+
19+
"v1 component" {
20+
val v = Vec1 { it.f }
21+
val (x) = v
22+
x shouldBe 0f
23+
}
24+
"v1i component" {
25+
val v = Vec1i { it }
26+
val (x) = v
27+
x shouldBe 0
28+
}
29+
"v2 component" {
30+
val v = Vec2 { it.f }
31+
val (x, y) = v
32+
x shouldBe 0f
33+
y shouldBe 1f
34+
}
35+
"v2i component" {
36+
val v = Vec2i { it }
37+
val (x, y) = v
38+
x shouldBe 0
39+
y shouldBe 1
40+
}
41+
"v3 component" {
42+
val v = Vec3 { it.f }
43+
val (x, y, z) = v
44+
x shouldBe 0f
45+
y shouldBe 1f
46+
z shouldBe 2f
47+
}
48+
"v3i component" {
49+
val v = Vec3i { it }
50+
val (x, y, z) = v
51+
x shouldBe 0
52+
y shouldBe 1
53+
z shouldBe 2
54+
}
55+
"v4 component" {
56+
val v = Vec4 { it.f }
57+
val (x, y, z, w) = v
58+
x shouldBe 0f
59+
y shouldBe 1f
60+
z shouldBe 2f
61+
w shouldBe 3f
62+
}
63+
"v4i component" {
64+
val v = Vec4i { it }
65+
val (x, y, z, w) = v
66+
x shouldBe 0
67+
y shouldBe 1
68+
z shouldBe 2
69+
w shouldBe 3
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)