test19.spec.js 715 B

12345678910111213141516171819202122232425
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { IVProgProcessor} from './../js/processor/ivprogProcessor'
  3. import { LanguageService } from '../js/services/languageService';
  4. describe('Multi(*) operation', function () {
  5. let input = `programa {
  6. funcao inicio() {
  7. inteiro a
  8. a = -2 + 2 * 4 + 2
  9. }
  10. }`;
  11. const lexer = LanguageService.getCurrentLexer();
  12. it(`should have higher priority than Sum(+)`, function (done) {
  13. const parser = new IVProgParser(input, lexer);
  14. const exec = new IVProgProcessor(parser.parseTree());
  15. exec.interpretAST().then(sto => {
  16. expect(sto.applyStore('a').number).toEqual(8);
  17. done();
  18. }).catch( err => done(err));
  19. });
  20. });