Skip to content

Commit

Permalink
0.9.9.1-11
Browse files Browse the repository at this point in the history
vars-interface bug, missing `operator` modifier
  • Loading branch information
elect86 committed Apr 25, 2023
1 parent c5a0b38 commit 4849500
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 6 deletions.
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ pluginManagement {

gradle.rootProject {
group = "kotlin.graphics"
version = "0.9.9.1-10"
version = "0.9.9.1-11"
}
2 changes: 1 addition & 1 deletion src/main/kotlin/glm_/glm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ val GLM_VERSION_MAJOR = 0
val GLM_VERSION_MINOR = 9
val GLM_VERSION_PATCH = 9
val GLM_VERSION_REVISION = 1
val GLM_VERSION_BUILD = 10
val GLM_VERSION_BUILD = 11
val GLM_VERSION = GLM_VERSION_MAJOR * 1_000 + GLM_VERSION_MINOR * 100 + GLM_VERSION_PATCH * 10 + GLM_VERSION_REVISION

/*
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/glm_/vec1/Vec1Vars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package glm_.vec1
interface Vec1Vars<T : Number> {
var x: T

fun component1() = x
operator fun component1() = x


// -- Component accesses --
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/glm_/vec2/Vec2Vars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import glm_.vec1.Vec1Vars
interface Vec2Vars<T : Number> : Vec1Vars<T> {
var y: T

fun component2() = y
operator fun component2() = y


// -- Component accesses --
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/glm_/vec3/Vec3Vars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import glm_.vec2.Vec2Vars
interface Vec3Vars<T : Number> : Vec2Vars<T> {
var z: T

fun component3() = z
operator fun component3() = z


// -- Component accesses --
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/glm_/vec4/Vec4Vars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import glm_.vec3.Vec3Vars
interface Vec4Vars<T : Number> : Vec3Vars<T> {
var w: T

fun component4() = w
operator fun component4() = w


// -- Component accesses --
Expand Down
72 changes: 72 additions & 0 deletions src/test/kotlin/glm_/testVectorComponent.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package glm_

import glm_.vec1.Vec1
import glm_.vec1.Vec1i
import glm_.vec2.Vec2
import glm_.vec2.Vec2i
import glm_.vec3.Vec3
import glm_.vec3.Vec3i
import glm_.vec4.Vec4
import glm_.vec4.Vec4i
import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe


class testVectorComponent : StringSpec() {

init {

"v1 component" {
val v = Vec1 { it.f }
val (x) = v
x shouldBe 0f
}
"v1i component" {
val v = Vec1i { it }
val (x) = v
x shouldBe 0
}
"v2 component" {
val v = Vec2 { it.f }
val (x, y) = v
x shouldBe 0f
y shouldBe 1f
}
"v2i component" {
val v = Vec2i { it }
val (x, y) = v
x shouldBe 0
y shouldBe 1
}
"v3 component" {
val v = Vec3 { it.f }
val (x, y, z) = v
x shouldBe 0f
y shouldBe 1f
z shouldBe 2f
}
"v3i component" {
val v = Vec3i { it }
val (x, y, z) = v
x shouldBe 0
y shouldBe 1
z shouldBe 2
}
"v4 component" {
val v = Vec4 { it.f }
val (x, y, z, w) = v
x shouldBe 0f
y shouldBe 1f
z shouldBe 2f
w shouldBe 3f
}
"v4i component" {
val v = Vec4i { it }
val (x, y, z, w) = v
x shouldBe 0
y shouldBe 1
z shouldBe 2
w shouldBe 3
}
}
}

0 comments on commit 4849500

Please sign in to comment.