예제 #1
0
 @Test
 public void number() {
   String n1 = "111";
   assertEquals(111, ValueComputer.computeInt(n1).intValue());
   String n2 = "111.222E2";
   assertEquals(11122.2, ValueComputer.computeFloat(n2), 0.01);
   String n3 = "111.222";
   assertEquals(111.222, ValueComputer.computeFloat(n3), 0.01);
   String n4 = "111.2E-2";
   assertEquals(1.112, ValueComputer.computeFloat(n4), 0.01);
 }
예제 #2
0
 @Test
 public void stringConstant() {
   String pascal_str1 = "i love ''game''";
   assertEquals("i love 'game'", ValueComputer.computeString(pascal_str1));
   String pascal_str2 = "I love \n this game";
   String pascal_str3 = "I love \r\n this game";
   String pascal_str4 = "I love \r this game";
   System.out.println(pascal_str2);
   assertEquals("I love   this game", ValueComputer.computeString(pascal_str2));
   assertEquals("I love   this game", ValueComputer.computeString(pascal_str3));
   assertEquals("I love   this game", ValueComputer.computeString(pascal_str4));
 }