All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.dev.folomeev.kotgl.matrix.vectors.mutables.MutableVec2Test.kt Maven / Gradle / Ivy

The newest version!
package dev.folomeev.kotgl.matrix.vectors.mutables

import dev.folomeev.kotgl.matrix.vectors.assertEquals
import kotlin.test.Test

class MutableVec2Test {
    @Test
    fun mutableVec2_createAndMutate() {
        MutableVec2.Implementation(1f, 2f).also { vec ->
            assertEquals(1f, 2f, vec)
            vec.x = 3f
            vec.y = 4f
            assertEquals(3f, 4f, vec)
        }
    }

    @Test
    fun mutableVec2_copyOf() {
        MutableVec2.Implementation(1f, 2f).also { vec ->
            val vecCopy = vec.copyOf()
            assertEquals(1f, 2f, vecCopy)
            vecCopy.set(3f, 4f)
            assertEquals(3f, 4f, vecCopy)
            // Assert that original value unchanged
            assertEquals(1f, 2f, vec)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy