Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit d072df55c71ed2272af2f3daf6a9e8667777fde0
- Author: Marcelo Fornet <mfornet94@gmail.com>
- Date: Sun Oct 20 22:19:04 2019 -0500
- Allow solutions to run in windows.
- Warn about 0 testcases.
- diff --git a/src/core.ts b/src/core.ts
- index 2b77d85..d2f675c 100644
- --- a/src/core.ts
- +++ b/src/core.ts
- @@ -350,7 +350,7 @@ export function timedRun(path: string, tcName: string, timeout: number){
- closeSync(inputFd);
- let startTime = new Date().getTime();
- - let command = `${join(path, ATTIC, "sol")}`;
- + let command = `${join(path, ATTIC, "sol.exe")}`;
- let xresult = child_process.spawnSync(command, {
- input: tcData,
- @@ -449,7 +449,7 @@ export function compileCode(pathCode: string, pathOutput: string){
- export function testSolution(path: string){
- let sol = join(path, solFile());
- - let out = join(path, ATTIC, 'sol');
- + let out = join(path, ATTIC, 'sol.exe');
- if (!existsSync(sol)){
- throw new Error("Open a coding environment first.");
- @@ -463,6 +463,11 @@ export function testSolution(path: string){
- }
- let testcasesId = testcasesName(path);
- +
- + if (testcasesId.length === 0){
- + return new SolutionResult(Veredict.NO_TESTCASES, undefined, undefined);
- + }
- +
- // Proccess all testcases in sorted order
- testcasesId.sort();
- @@ -477,16 +482,13 @@ export function testSolution(path: string){
- let results: TestcaseResult[] = [];
- let fail: SolutionResult | undefined = undefined;
- -
- testcasesId.forEach(tcId => {
- // Run while there none have failed already
- if (fail === undefined){
- let tcResult = timedRun(path, tcId, getTimeout());
- -
- if (tcResult.status !== Veredict.OK){
- fail = new SolutionResult(tcResult.status, tcId);
- }
- -
- results.push(tcResult);
- }
- });
- diff --git a/src/extension.ts b/src/extension.ts
- index f663028..efe9e10 100644
- --- a/src/extension.ts
- +++ b/src/extension.ts
- @@ -129,6 +129,9 @@ async function runSolution(){
- if (result.status === Veredict.OK){
- vscode.window.showInformationMessage(`OK. Time ${result.maxTime!}ms`);
- }
- + else if (result.status === Veredict.NO_TESTCASES){
- + vscode.window.showErrorMessage(`No testcases.`);
- + }
- else{
- vscode.window.showErrorMessage(`${veredictName(result.status)} on test ${result.failTcId}`);
- debugTestcase(path, result.failTcId!);
- diff --git a/src/types.ts b/src/types.ts
- index 595ac22..209b4aa 100644
- --- a/src/types.ts
- +++ b/src/types.ts
- @@ -4,6 +4,7 @@ export enum Veredict{
- TLE, // Time Limit Exceeded
- RTE, // Runtime Error
- CE, // Compilation Error
- + NO_TESTCASES,
- }
- export class TestcaseResult{
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement