From 0753311b93b125e10d6c7204bd9d9949dbf0c3c4 Mon Sep 17 00:00:00 2001 From: Umur Ozkul Date: Thu, 19 May 2022 17:00:00 +0200 Subject: [PATCH] logical tests --- .../Reducer_Peggy_Parse_test.res | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res index d4b69729..35822f88 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res @@ -91,6 +91,29 @@ describe("Peggy parse", () => { ) //nested if }) + describe("logical", ()=> { + testParse("true || false", "{(::or true false)}") + testParse("true && false", "{(::and true false)}") + testParse("a && b || c", "{(::and :a (::or :b :c))}") + testParse("a && b || c && d", "{(::and (::and :a (::or :b :c)) :d)}") + testParse("a && !b || c", "{(::and :a (::or (::not :b) :c))}") + testParse("a && b==c || d", "{(::and :a (::or (::equal :b :c) :d))}") + testParse("a && b!=c || d", "{(::and :a (::or (::unequal :b :c) :d))}") + testParse("a && !(b==c) || d", "{(::and :a (::or (::not (::equal :b :c)) :d))}") + testParse("a && b>=c || d", "{(::and :a (::or (::largerEq :b :c) :d))}") + testParse("a && !(b>=c) || d", "{(::and :a (::or (::not (::largerEq :b :c)) :d))}") + testParse("a && b<=c || d", "{(::and :a (::or (::smallerEq :b :c) :d))}") + testParse("a && b>c || d", "{(::and :a (::or (::larger :b :c) :d))}") + testParse("a && b { testParse("1 -> add(2)", "{(::add 1 2)}") testParse("-1 -> add(2)", "{(::add (::unaryMinus 1) 2)}")