assessment.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import * as LocalizedStringsService from "../services/localizedStringsService";
  2. import { Config } from "../util/config";
  3. const LocalizedStrings = LocalizedStringsService.getInstance();
  4. const AssessmentConfig = {
  5. max_instruction_count: 350250,
  6. suspend_threshold: 200,
  7. };
  8. export class Assessment {
  9. constructor (ast_code, testCases, domConsole) {
  10. this.ast_code = ast_code;
  11. this.testCases = testCases;
  12. this.domConsole = domConsole;
  13. this.old_config = JSON.parse(JSON.stringify(Config));
  14. Config.setConfig(AssessmentConfig);
  15. }
  16. runTest () {
  17. // abstract
  18. }
  19. showErrorMessage (errorID, ...args) {
  20. this.domConsole.err(LocalizedStrings.getError(errorID, args));
  21. }
  22. showInfoMessage (msgID, ...args) {
  23. this.domConsole.info(LocalizedStrings.getMessage(msgID, args));
  24. }
  25. writeToConsole (channel, msgType, msgID, ...args) {
  26. let msg = LocalizedStrings.getString(msgID, msgType);
  27. msg = LocalizedStrings.processString(msg, args);
  28. this.domConsole.writeRawHTML(msg, channel);
  29. }
  30. }