Esempio n. 1
0
 public void ConstantJnz()
 {
     Test(new Dictionary <string, int> {
         { "a", 0 }, { "b", -20 }, { "c", -2 }
     },
          SimpleAssembler.Interpret(new[] { "mov a -10", "mov b a", "mov c -2", "inc a", "dec b", "jnz a c" }));
 }
Esempio n. 2
0
 public void ExtremeCase()
 {
     Test(new Dictionary <string, int> {
         { "ab", 5 }, { "bb", 5 }
     },
          SimpleAssembler.Interpret(new[] { "mov ab 5", "mov bb ab", "jnz cb 2", "dec ab", "jnz ab 15" }));
 }
Esempio n. 3
0
 public void ExamplePrograms()
 {
     Test(new Dictionary <string, int> {
         { "a", 1 }
     },
          SimpleAssembler.Interpret(new[] { "mov a 5", "inc a", "dec a", "dec a", "jnz a -1", "inc a" }));
     Test(new Dictionary <string, int> {
         { "a", 0 }, { "b", -20 }
     },
          SimpleAssembler.Interpret(new[] { "mov a -10", "mov b a", "inc a", "dec b", "jnz a -2" }));
 }