Exemple #1
0
 public void TestUntil()
 {
     Assert.AreEqual("1024", TestHelper.GenerateNRun(@"begin var a3,b3; b3:=1; a3:=10; repeat a3:=a3-1; b3:=b3*2 until a3; write(b3) end"));
 }
Exemple #2
0
 public void TestWhile()
 {
     Assert.AreEqual("1024", TestHelper.GenerateNRun(@"begin var a2,b2; b2:=1; a2:=10; while a2 do begin a2:=a2-1; b2:=b2*2; end; write(b2) end"));
 }
Exemple #3
0
 public void TestIntDivMod()
 {
     Assert.AreEqual("48", TestHelper.GenerateNRun(@"begin var a; a := (232 / 5) + (232 % 5); write(a) end"));
 }
Exemple #4
0
        public void TestIf()
        {
            Assert.AreEqual("3", TestHelper.GenerateNRun(@"begin var a1; a1 := 0; if a1 then write(2) else write(3) end"));

            Assert.AreEqual("3", TestHelper.GenerateNRun(@"begin var x,y; x := 1; y := x-1; if x then if y then write(2) else write(3) end"));
        }
Exemple #5
0
 public void TestOutput()
 {
     Assert.AreEqual("2", TestHelper.GenerateNRun(@"begin write(2) end"));
 }