Skip to content

Commit 5bec1a9

Browse files
committed
変数を渡す例を示しました。
1 parent cb83089 commit 5bec1a9

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@
6969
val value = Calculator()
7070
.plugin(Function("f(x)", arrayOf("x + 1")))
7171
.plugin(Function("g(x,y)", arrayOf("f(x) * y")))
72-
.eval("g(3,4)")
72+
.eval("x = 3")
73+
.eval("y = 4")
74+
.eval("g(x,y)")
7375
.value
7476
println(value)
7577

src/test/kotlin/xyz/javecs/tools/expr/test/kotlin/CalculatorPluginTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class CalculatorPluginTest {
1616
val value = Calculator()
1717
.plugin(Function("f(x)", arrayOf("x + 1")))
1818
.plugin(Function("g(x,y)", arrayOf("f(x) * y")))
19-
.eval("g(3,4)")
19+
.eval("x = 3")
20+
.eval("y = 4")
21+
.eval("g(x,y)")
2022
.value
2123
assertEquals(16, value)
2224
}

0 commit comments

Comments
 (0)