Skip to content

Commit

Permalink
Add error messages in test report
Browse files Browse the repository at this point in the history
  • Loading branch information
slycelote committed Mar 5, 2022
1 parent f83695e commit 8506e3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions libcaide/res/templates/test_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int main() {
ret = runCommand(false, caideExe, "convert_test_input", origInputFile, inputFile);
if (ret != 0) {
cerr << "Test converter for test " << testName << " failed" << endl;
report << testName << " error" << endl;
report << testName << " error Test input converter failed" << endl;
continue;
}
#else
Expand All @@ -115,7 +115,7 @@ int main() {
solve(in, out);
} catch (const exception& e) {
cerr << "Test " << testName << " threw an exception: " << e.what() << endl;
report << testName << stopwatch.GetDuration() << " failed" << endl;
report << testName << stopwatch.GetDuration() << " failed " << e.what() << endl;
continue;
} catch (...) {
cerr << "Test " << testName << " threw an exception" << endl;
Expand Down Expand Up @@ -148,9 +148,13 @@ int main() {
cerr << "FAILED: " << message << endl;
report << testName << duration << " failed " << message << endl;
}
} catch (const exception& e) {
cerr << "Checker for test " << testName << " threw an exception: " << e.what() << endl;
report << testName << duration << " error Custom checker failed: " << e.what() << endl;
continue;
} catch (...) {
cerr << "Checker for test " << testName << " threw an exception" << endl;
report << testName << duration << " error" << endl;
report << testName << duration << " error Custom checker failed" << endl;
continue;
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions libcaide/res/templates/test_template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static void Main(string[] args)
Process p = Run(caideExe, "convert_test_input", origInputFile, inputFile);
if (p.ExitCode != 0) {
Console.Error.WriteLine("Test converter for test " + testName + " failed");
report.WriteLine(testName + " error");
report.WriteLine(testName + " error Test input converter failed");
continue;
}
}
Expand All @@ -94,7 +94,7 @@ public static void Main(string[] args)
catch (Exception e)
{
Console.Error.WriteLine("Test " + testName + " threw an exception: " + e);
report.WriteLine(testName + getDuration() + " failed");
report.WriteLine(testName + getDuration() + " failed " + e.Message);
continue;
}

Expand Down Expand Up @@ -131,7 +131,7 @@ public static void Main(string[] args)
catch (Exception e)
{
Console.Error.WriteLine("Checker for test " + testName + " threw an exception: " + e.Message);
report.WriteLine(testName + getDuration() + " error");
report.WriteLine(testName + getDuration() + " error Custom checker threw an exception: " + e.Message);
}
}
else
Expand Down

0 comments on commit 8506e3f

Please sign in to comment.