Skip to content

Commit

Permalink
test: Verify unary-test expressions
Browse files Browse the repository at this point in the history
Add test cases for unary-test expressions to verify that an expression returns false.
  • Loading branch information
saig0 committed Jan 16, 2025
1 parent 61a5064 commit 113f7bc
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -655,4 +655,24 @@ class InterpreterUnaryTest
evaluateUnaryTests("5 < ? or ? < 10", inputValue = null) should returnNull()
}

it should "return true if it evaluates to true" in {

evaluateUnaryTests("x", inputValue = 3, variables = Map("x" -> true)) should returnResult(true)
evaluateUnaryTests("4 < 10", 3) should returnResult(true)
evaluateUnaryTests("even(4)", 3) should returnResult(true)
evaluateUnaryTests("list contains([1,2,3], 3)", 3) should returnResult(true)
}

it should "return false if it evaluates to false" in {

evaluateUnaryTests(
expression = "x",
inputValue = 3,
variables = Map("x" -> false)
) should returnResult(false)
evaluateUnaryTests(expression = "4 > 10", 3) should returnResult(false)
evaluateUnaryTests(expression = "odd(4)", 3) should returnResult(false)
evaluateUnaryTests(expression = "list contains([1,2], 3)", 3) should returnResult(false)
}

}

0 comments on commit 113f7bc

Please sign in to comment.