From a2e33bf6d8c2c4548cc1fdf02db6ffedfdce5f4b Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Sun, 7 Jun 2020 15:57:23 +0700 Subject: [PATCH] Add more test for ASM const product --- .../scientifik/kmath/expressions/AsmTest.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/kmath-asm/src/test/kotlin/scientifik/kmath/expressions/AsmTest.kt b/kmath-asm/src/test/kotlin/scientifik/kmath/expressions/AsmTest.kt index 98aa3706b..9ab6f26c9 100644 --- a/kmath-asm/src/test/kotlin/scientifik/kmath/expressions/AsmTest.kt +++ b/kmath-asm/src/test/kotlin/scientifik/kmath/expressions/AsmTest.kt @@ -66,6 +66,30 @@ class AsmTest { mapOf("x" to 5.0) ) + @Test + fun testCProductWithOtherTypeNumber() = testDoubleExpressionValue( + 25.0, + AsmConstProductExpression(AsmVariableExpression("x"), 5f), + mapOf("x" to 5.0) + ) + + object CustomZero : Number() { + override fun toByte(): Byte = 0 + override fun toChar(): Char = 0.toChar() + override fun toDouble(): Double = 0.0 + override fun toFloat(): Float = 0f + override fun toInt(): Int = 0 + override fun toLong(): Long = 0L + override fun toShort(): Short = 0 + } + + @Test + fun testCProductWithCustomTypeNumber() = testDoubleExpressionValue( + 0.0, + AsmConstProductExpression(AsmVariableExpression("x"), CustomZero), + mapOf("x" to 5.0) + ) + @Test fun testVar() = testDoubleExpressionValue( 10000.0,