diff --git a/kmath-common/src/test/kotlin/scientifik/kmath/expressions/FieldExpressionContextTest.kt b/kmath-common/src/test/kotlin/scientifik/kmath/expressions/FieldExpressionContextTest.kt index dda267ec8..543e13d79 100644 --- a/kmath-common/src/test/kotlin/scientifik/kmath/expressions/FieldExpressionContextTest.kt +++ b/kmath-common/src/test/kotlin/scientifik/kmath/expressions/FieldExpressionContextTest.kt @@ -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 FieldExpressionContext.expression(): Expression{ + val x = variable("x") + return x * x + 2 * x + 1.0 + } + + val expression = FieldExpressionContext(DoubleField).expression() + assertEquals(expression("x" to 1.0), 4.0) + } } \ No newline at end of file