Browse Source

Finished implementation and testing of ShowOutputDiff

master
Patrick G 1 year ago
parent
commit
50cf4402a4
Signed by: geek1011 GPG Key ID: A2FD79F68A2AB707
6 changed files with 57 additions and 33 deletions
  1. +0
    -0
      child1/vpl_test
  2. +50
    -30
      child2/cases.txt
  3. +0
    -0
      child2/vpl_test
  4. +1
    -1
      parent/evaluate_testing.sh
  5. +2
    -2
      parent/grader.go
  6. +4
    -0
      parent/vcase.py

child1/vpl_execution → child1/vpl_test View File


+ 50
- 30
child2/cases.txt View File

@ -1,140 +1,160 @@
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
64
27
35
24
---
a + b = 91
a + b = 59
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
49
85
75
56
---
a + b = 134
a + b = 131
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
31
95
35
44
---
a + b = 126
a + b = 79
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
14
74
80
16
---
a + b = 88
a + b = 96
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
11
94
83
28
---
a + b = 105
a + b = 111
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
59
89
98
3
---
a + b = 148
a + b = 101
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
15
41
86
54
---
a + b = 56
a + b = 140
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
74
29
31
59
---
a + b = 103
a + b = 90
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
75
87
82
28
---
a + b = 162
a + b = 110
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
Marks = 1
---
4
34
8
91
---
a + b = 38
a + b = 99
===

child2/vpl_execution → child2/vpl_test View File


+ 1
- 1
parent/evaluate_testing.sh View File

@ -3,5 +3,5 @@ SCRIPTDIR="$(dirname "$0")"
rm -f .grader
go build -o .grader "${SCRIPTDIR}/grader.go"
/usr/bin/time -v ./.grader -grademin "${VPL_GRADEMIN:-0}" -grademax "${VPL_GRADEMAX:-0}" -maxtime "${VPL_MAXTIME:-20}" cases.txt
./.grader -grademin "${VPL_GRADEMIN:-0}" -grademax "${VPL_GRADEMAX:-0}" -maxtime "${VPL_MAXTIME:-20}" cases.txt
rm -f .grader

+ 2
- 2
parent/grader.go View File

@ -299,10 +299,10 @@ func (t *Tester) RunCase(caseNumber int, tc *TestCase, timeout time.Duration, ru
if tc.IsNormalized() && actual != output {
comment += " --- Output (normalized) ---\n"
comment += VPLCaseFormat(actual)
if len(actual) > 0 {
if len(actual) > 0 && tc.ShowOutputDiff {
comment += diffComment(actual, expected)
}
} else if len(output) > 0 {
} else if len(output) > 0 && tc.ShowOutputDiff {
comment += diffComment(output, tc.Output)
}
if len(output) > 0 {

+ 4
- 0
parent/vcase.py View File

@ -5,6 +5,7 @@ class VCase(object):
self.__FailMessage = None
self.__ShowPassOutput = False
self.__HideFailOutput = False
self.__ShowOutputDiff = False
self.__UseRegexp = False
self.__NormalizeWhitespace = False
self.__TrimWhitespace = False
@ -22,6 +23,8 @@ class VCase(object):
self.__ShowPassOutput = v
def hide_fail_output(self, v: bool):
self.__HideFailOutput = v
def show_output_diff(self, v: bool):
self.__ShowOutputDiff = v
def use_regexp(self, v: bool):
self.__UseRegexp = v
def normalize_whitespace(self, v: bool):
@ -43,6 +46,7 @@ class VCase(object):
self.__print_kv("FailMessage", self.__FailMessage)
self.__print_kv("ShowPassOutput", self.__ShowPassOutput)
self.__print_kv("HideFailOutput", self.__HideFailOutput)
self.__print_kv("ShowOutputDiff", self.__ShowOutputDiff)
self.__print_kv("UseRegexp", self.__UseRegexp)
self.__print_kv("NormalizeWhitespace", self.__NormalizeWhitespace)
self.__print_kv("TrimWhitespace", self.__TrimWhitespace)

Loading…
Cancel
Save