From 90c287d42fe2b2f7703ae4dad80da824bf05e125 Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Fri, 26 Jun 2020 15:59:24 +0700 Subject: [PATCH] Add tests for MapInstrinsics --- .../scietifik/kmath/asm/TestAsmVariables.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 kmath-ast/src/jvmTest/kotlin/scietifik/kmath/asm/TestAsmVariables.kt diff --git a/kmath-ast/src/jvmTest/kotlin/scietifik/kmath/asm/TestAsmVariables.kt b/kmath-ast/src/jvmTest/kotlin/scietifik/kmath/asm/TestAsmVariables.kt new file mode 100644 index 000000000..aafc75448 --- /dev/null +++ b/kmath-ast/src/jvmTest/kotlin/scietifik/kmath/asm/TestAsmVariables.kt @@ -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 { expr() } + } +}