forked from kscience/kmath
Context separation test for expressions
This commit is contained in:
parent
6df416f064
commit
6c25042f0f
@ -28,4 +28,15 @@ class FieldExpressionContextTest {
|
||||
assertEquals(expression("x" to Complex(1.0, 0.0)), Complex(4.0, 0.0))
|
||||
assertEquals(expression(), Complex(9.0, 0.0))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun separateContext() {
|
||||
fun <T> FieldExpressionContext<T>.expression(): Expression<T>{
|
||||
val x = variable("x")
|
||||
return x * x + 2 * x + 1.0
|
||||
}
|
||||
|
||||
val expression = FieldExpressionContext(DoubleField).expression()
|
||||
assertEquals(expression("x" to 1.0), 4.0)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user