Skip to content

Commit

Permalink
add more comparison operator with variable
Browse files Browse the repository at this point in the history
  • Loading branch information
warmwaffles committed Feb 17, 2023
1 parent c58feec commit dd6526b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/json_logic_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,16 @@ defmodule JsonLogicTest do
end

describe ">" do
test "comparison with variables" do
logic = %{">" => [%{"var" => "quantity"}, 25]}
data = %{"quantity" => 1}
assert JsonLogic.resolve(logic, data) == false

logic = %{">" => [%{"var" => "quantity"}, 25]}
data = %{"abc" => 1}
assert JsonLogic.resolve(logic, data) == false
end

test "integer, float, and decimal comparisons" do
ones = [Decimal.new("1.0"), "1.0", "1", 1.0, 1]
twos = [Decimal.new("2.0"), "2.0", "2", 2.0, 2]
Expand Down

0 comments on commit dd6526b

Please sign in to comment.