1
0

test24.spec.js 775 B

12345678910111213141516171819202122232425262728
  1. import Lexers from './../grammar/';
  2. import { IVProgParser } from './../js/ast/ivprogParser';
  3. import { IVProgProcessor} from './../js/processor/ivprogProcessor'
  4. import { LanguageService } from '../js/services/languageService';
  5. describe('Command Do...While', function () {
  6. let input = `programa {
  7. funcao inicio() {
  8. inteiro a = 0
  9. faca {
  10. a = a + 1
  11. } enquanto(a < 5)
  12. }
  13. }`;
  14. const lexer = LanguageService.getCurrentLexer();
  15. it(`should result in a valid state`, function (done) {
  16. const parser = new IVProgParser(input, lexer);
  17. const exec = new IVProgProcessor(parser.parseTree());
  18. exec.interpretAST().then(sto => {
  19. expect(sto.applyStore('a').value).toEqual(5);
  20. done();
  21. }).catch( err => done(err));
  22. });
  23. });