Add tests for MapInstrinsics

This commit is contained in:
Iaroslav 2020-06-26 15:59:24 +07:00
parent 5ab6960e9b
commit 90c287d42f
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7

View File

@ -0,0 +1,22 @@
package scietifik.kmath.asm
import scientifik.kmath.ast.mstInRing
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.ByteRing
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
internal class TestAsmVariables {
@Test
fun testVariableWithoutDefault() {
val expr = ByteRing.mstInRing { symbol("x") }
assertEquals(1.toByte(), expr("x" to 1.toByte()))
}
@Test
fun testVariableWithoutDefaultFails() {
val expr = ByteRing.mstInRing { symbol("x") }
assertFailsWith<IllegalStateException> { expr() }
}
}