import org.jostraca.tree.Node;
public class ExprTest extends TestCase {
public void testHappy() {
Expr expr = new Expr() {
public Object eval(Node pNode) {
return null;
}
};
assertEquals( false, expr.convertToBoolean(null) );
assertEquals( false, expr.convertToBoolean(false) );
assertEquals( true, expr.convertToBoolean(true) );
assertEquals( false, expr.convertToBoolean(new Boolean(false)));
assertEquals( true, expr.convertToBoolean(new Boolean(true)));
assertEquals( true, expr.convertToBoolean(new Long(-1)));
assertEquals( false, expr.convertToBoolean(new Long(0)));
assertEquals( true, expr.convertToBoolean(new Long(1)));
assertEquals( true, expr.convertToBoolean(new Double(-1.0)));
assertEquals( false, expr.convertToBoolean(new Double(0.0)));
assertEquals( true, expr.convertToBoolean(new Double(1.0)));
assertEquals( true, expr.convertToBoolean("a"));
assertEquals( false, expr.convertToBoolean(""));
assertEquals( true, expr.convertToBoolean("true"));
assertEquals( false, expr.convertToBoolean("false"));
}