test19.spec.js 707 B

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