예제 #1
0
 public void ParseOnlyAllowsSimpleExpressions()
 {
     Parse twoPlusThree = new Parse("2 - 5 + 3");
     twoPlusThree.setOperatorIndex();
     twoPlusThree.firstNum();
     twoPlusThree.secondNum();
 }
예제 #2
0
 public void ParseOnlyAllowsNumbersSecond()
 {
     Parse twoPlusThree = new Parse("2 + b");
     twoPlusThree.setOperatorIndex();
     twoPlusThree.firstNum();
     twoPlusThree.secondNum();
 }
예제 #3
0
 public void ParseCanFindSecondNum()
 {
     Parse twoPlusThree = new Parse("2 + 3");
     twoPlusThree.setOperatorIndex();
     twoPlusThree.firstNum();
     Assert.AreEqual(3, twoPlusThree.secondNum());
 }
예제 #4
0
 public void ParseAllowsConstantsFirst()
 {
     Constant newConstant = new Constant();
     Parse aplus3 = new Parse("a + 3", newConstant);
     aplus3.addConst("a", 5);
     aplus3.setOperatorIndex();
     Assert.AreEqual(5, aplus3.firstNum());
 }
예제 #5
0
 public void ParseOnlyAllowsNumbersFirst()
 {
     Parse twoPlusThree = new Parse("a + 3");
     twoPlusThree.firstNum();
 }