/*
 * BaseElRegexTest.java
 *
 * Created on 2007/03/19, 14:10
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package test.org.itscool.stylist.el;

import junit.framework.TestCase;

import org.itscool.stylist.el.BaseElRegex;

public class BaseElRegexTest3 extends TestCase{
    public void testParseFunction(){
        BaseElRegex regex = new BaseElRegex();
        String el = "mathC.add(1, 2)";
        String result = regex.parseFunction(el);
        assertEquals(el,"3", result);
    }
    
    public void testParseFunction2(){
        BaseElRegex regex = new BaseElRegex();
        String el = "mathC.kakeru(10, 2)";
        String result = regex.parseFunction(el);
        assertEquals(el,"20", result);
    }
    
    public void testParseFunction3(){
        BaseElRegex regex = new BaseElRegex();
        String el = "mathC.kakeru(100, 1.05, 3)";
        String result = regex.parseFunction(el);
        assertEquals(el,"105", result);
    }
    
    public void testParseFunction4(){
        BaseElRegex regex = new BaseElRegex();
        String el = "mathC.waru(1, 3, 3)";
        String result = regex.parseFunction(el);
        assertEquals(el,"0.33", result);
    }
    
    public void testParseFunction5(){
        BaseElRegex regex = new BaseElRegex();
        String el = "mathC.mod(10, 3)";
        String result = regex.parseFunction(el);
        assertEquals(el,"1", result);
    }
    
    public void testReplaceFunction(){
        BaseElRegex regex = new BaseElRegex();
        String result = regex.replaceFunction(null, "1 + 2 = ${mathC.add(1, 2)} !");
        assertEquals("result", "1 + 2 = 3 !", result);
    }
    
}
