Context separation test for expressions

This commit is contained in:
Alexander Nozik 2018-08-25 21:36:50 +03:00
parent 6df416f064
commit 6c25042f0f

View File

@ -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)
}
}