/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package gov.nih.nci.cabig.caaers.utils.el;

import junit.framework.TestCase;

public class ELTest extends TestCase {

    private EL el = new EL();

    public void testMath() {
        assertEquals("2", el.evaluate("${1 + 1}"));
        assertEquals("5", el.evaluate("${10 - 5}"));
        assertEquals("true", el.evaluate("${true && (false || true)}"));
        assertEquals("true", el.evaluate("${true && (false || (true && true && (true || false)))}"));
        assertEquals("false", el.evaluate("${true && (false || (true && true && (false || false)))}"));
        assertEquals("true", el.evaluate("${true || false}"));
        assertEquals("true", el.evaluate("${true}"));
    }
}
@@ -1519,9 +1519,709 @@
 %0A    %7D%0D%0A
+    %0D%0A    public void testString()%7B%0D%0A    %09assertEquals(%22testString%22,el.evaluate(%22testString%22));%0D%0A    %7D%0D%0A    %0D%0A    public void testBooleanLiteral()%7B%0D%0A    %09assertEquals(%22false%22,el.evaluate(%22false%22));%0D%0A    %7D%0D%0A    %0D%0A    public void testExpression()%7B%0D%0A    %09assertEquals(%229.0%22,el.evaluate(%22$%7B2*5 + 12/3 -5%7D%22));%0D%0A    %09assertEquals(%22true%22,el.evaluate(%22$%7B4.0 %3E= 3%7D%22));%0D%0A    %09assertEquals(%2212001.4%22,el.evaluate(%22$%7B1.2E4 + 1.4%7D%22));%0D%0A    %09assertEquals(%221.0%22,el.evaluate(%22$%7B1.0 mod 3%7D%22));%0D%0A    %7D%0D%0A    %0D%0A    public void testIncorrectInput()%7B%0D%0A    %09try %7B%0D%0A    %09%09assertEquals(%229.0%22,el.evaluate(%22$%7BABoi23*344/167uio98%7D%22));%0D%0A    %09%09fail(%22Test should have failed%22);%0D%0A    %09%7D catch (Exception ex)%7B%0D%0A    %09%09%0D%0A    %09%7D%0D%0A    %7D%0D%0A
 %7D

test cases coverage