Пример #1
0
 @Test
 public void nullValueReturnsNullType() throws PseudoException {
   ArgumentListEvaluator arguments = new ArgumentListEvaluator();
   arguments.addArg(new NullEvaluator());
   fnCallEval.setArgumentsList(arguments);
   Type ret = fnCallEval.evaluate(scope);
   assertEquals(
       "The return type must be \"String\" regardless of input",
       Type.STRING_TYPE,
       ret.getPseudoType());
   assertEquals("The return value must be \"Null\"", "Null", ret.getValue());
 }
Пример #2
0
 @Test
 public void integerMultipliedByDoubleIsADouble() throws PseudoException {
   MultEvaluator evaluator = new MultEvaluator(new IntegerEvaluator(0), new DoubleEvaluator(0.0));
   Type ret = evaluator.evaluate(scope);
   assertEquals("0*0.0 must be double 0.0.", 0.0, (Double) ret.getValue(), 0.01);
 }
Пример #3
0
 @Test
 public void doubleMultipliedByIntegerIsADouble() throws PseudoException {
   MultEvaluator evaluator = new MultEvaluator(new DoubleEvaluator(3.0), new IntegerEvaluator(3));
   Type ret = evaluator.evaluate(scope);
   assertEquals("3.0*3 must be double 9.0.", 9.0, (Double) ret.getValue(), 0.01);
 }
Пример #4
0
 @Test
 public void integerMultipliedByIntegerIsAnInteger() throws PseudoException {
   MultEvaluator evaluator = new MultEvaluator(new IntegerEvaluator(1), new IntegerEvaluator(1));
   Type ret = evaluator.evaluate(scope);
   assertEquals("1*1 must be integer 1.", 1, ret.getValue());
 }