Added ComplexField test for expressions.
This commit is contained in:
parent
520765abb9
commit
6df416f064
@ -1,5 +1,7 @@
|
||||
package scientifik.kmath.expressions
|
||||
|
||||
import scientifik.kmath.operations.Complex
|
||||
import scientifik.kmath.operations.ComplexField
|
||||
import scientifik.kmath.operations.DoubleField
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
@ -15,4 +17,15 @@ class FieldExpressionContextTest {
|
||||
assertEquals(expression("x" to 1.0), 4.0)
|
||||
assertEquals(expression(), 9.0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testComplex() {
|
||||
val context = FieldExpressionContext(ComplexField)
|
||||
val expression = with(context) {
|
||||
val x = variable("x", Complex(2.0, 0.0))
|
||||
x * x + 2 * x + 1.0
|
||||
}
|
||||
assertEquals(expression("x" to Complex(1.0, 0.0)), Complex(4.0, 0.0))
|
||||
assertEquals(expression(), Complex(9.0, 0.0))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user