testMatrixSemantic.spec.js 754 B

1234567891011121314151617181920212223
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { IVProgProcessor} from './../js/processor/ivprogProcessor'
  3. import { SemanticAnalyser } from "./../js/processor/semantic/semanticAnalyser";
  4. import { LanguageService } from '../js/services/languageService';
  5. describe('A valid matrix declaration', function () {
  6. let input = `programa {
  7. funcao inicio() {
  8. real v[4][2] = {{1,1},{1,1},{1,1},{1,1}}
  9. }
  10. }`;
  11. const lexer = LanguageService.getCurrentLexer();
  12. it(`should not throw a semantic exception`, function () {
  13. const parser = new IVProgParser(input, lexer);
  14. const semantic = new SemanticAnalyser(parser.parseTree());
  15. const fun = semantic.analyseTree.bind(semantic);
  16. expect(fun).not.toThrow();
  17. });
  18. });