testMatrixSemantic.spec.js 687 B

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