package no.ssb.vtl.parser;


import org.junit.Test;

public class BooleanParserTest extends GrammarTest {

    @Test
    public void testNot() throws Exception {
        parse("not(true)", "booleanExpression");
        parse("not(false)", "booleanExpression");
        parse("not(true and false)", "booleanExpression");
        parse("not(a <> b or a = b and false)", "booleanExpression");
    }

    @Test
    public void testIsNull() throws Exception {
        parse("isnull(a)", "booleanExpression");
        parse("isnull(null)", "booleanExpression");
    }
}

@@ -100,16 +100,890 @@
 Test %7B%0A%0A
+    @Test%0A    public void testAlgebra() throws Exception %7B%0A        parse(%22true and false or false and true%22, %22booleanExpression%22);%0A        parse(%22true and (false or false) and true%22, %22booleanExpression%22);%0A        parse(%22not true and not (true or false) and not true%22, %22booleanExpression%22);%0A        parse(%22not ( ( true xor not (true or false) and not true ) )%22, %22booleanExpression%22);%0A    %7D%0A%0A    @Test%0A    public void testEquality() throws Exception %7B%0A        parse(%22dataset.component = component%22, %22booleanExpression%22);%0A        parse(%22dataset.component %3C%3E component%22, %22booleanExpression%22);%0A        parse(%22dataset.component %3C= component%22, %22booleanExpression%22);%0A        parse(%22dataset.component %3E= component%22, %22booleanExpression%22);%0A        parse(%22dataset.component %3C component%22, %22booleanExpression%22);%0A        parse(%22dataset.component %3E component%22, %22booleanExpression%22);%0A    %7D%0A%0A
     @Tes
@@ -1419,20 +1419,272 @@
 pression%22);%0A
+        parse(%22component is not null%22, %22booleanExpression%22);%0A        parse(%22dataset.component is not null%22, %22booleanExpression%22);%0A        parse(%22component is null%22, %22booleanExpression%22);%0A        parse(%22dataset.component is null%22, %22booleanExpression%22);%0A
     %7D%0A%7D%0A

Add more parser tests