fauton
Version:
A library to test any finite automaton with arbitrary alphabets
25 lines (24 loc) • 1.12 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateCaseMessage = void 0;
const colors_1 = __importDefault(require("colors"));
function generateCaseMessage(isWrong, randomInputString, dfaTestResult, logicTestResult) {
return {
withColors: `${[
`Result: ${isWrong ? colors_1.default.red.bold(`WRONG`) : colors_1.default.green.bold(`CORRECT`)}`,
`String: ${colors_1.default.yellow.bold(randomInputString)}`,
`Logic: ${colors_1.default.blue.bold(logicTestResult.toString())}`,
`FA: ${colors_1.default.blue.bold(dfaTestResult.toString())}`,
].join('\n')}\n`,
withoutColors: `${[
`Result: ${isWrong ? `WRONG` : `CORRECT`}`,
`String: ${randomInputString}`,
`Logic: ${logicTestResult}`,
`FA: ${dfaTestResult}`,
].join('\n')}\n`,
};
}
exports.generateCaseMessage = generateCaseMessage;