Browse Source

Output format docs

master
Patrick Gaskin 11 months ago
parent
commit
071040d285
Signed by: geek1011 GPG Key ID: A2FD79F68A2AB707
4 changed files with 234 additions and 41 deletions
  1. +50
    -40
      child2/cases.txt
  2. +5
    -0
      child2/generate.py
  3. +1
    -0
      child2/vcase.py
  4. +178
    -1
      docs/content/docs/reference/output-format.md

+ 50
- 40
child2/cases.txt View File

@ -1,160 +1,170 @@
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
35
24
52
50
---
a + b = 59
a + b = 102
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
75
56
45
97
---
a + b = 131
a + b = 142
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
35
44
57
4
---
a + b = 79
a + b = 61
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
80
16
46
34
---
a + b = 96
a + b = 80
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
83
28
12
38
---
a + b = 111
a + b = 50
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
98
3
62
79
---
a + b = 101
a + b = 141
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
86
54
60
18
---
a + b = 140
a + b = 78
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
31
59
97
82
---
a + b = 90
a + b = 169
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
82
28
80
23
---
a + b = 110
a + b = 93
===
PassMessage = Good job
ShowPassOutput = True
HideFailOutput = False
ShowOutputDiff = False
ShowOutputDiff = True
UseRegexp = False
NormalizeWhitespace = True
TrimWhitespace = True
NormalizeCase = False
NoShowNormalized = False
Marks = 1
---
8
91
48
69
---
a + b = 99
a + b = 117
===

+ 5
- 0
child2/generate.py View File

@ -7,12 +7,17 @@ for n in range(10):
case.show_pass_output(True)
case.trim_whitespace(True)
case.normalize_whitespace(True)
case.show_output_diff(True)
a, b = randint(0, 100), randint(0, 100)
case.input(a)
case.input(b)
c = a + b
if a > 70:
# Make it fail on purpose
c -= 10
case.output(f"a + b = {c}")
case.done()

+ 1
- 0
child2/vcase.py View File

@ -0,0 +1 @@
../parent/vcase.py

+ 178
- 1
docs/content/docs/reference/output-format.md View File

@ -1,3 +1,180 @@
---
title: Output format
---
---
# Output format
This page shows some of the output passed to the VPL (it looks a lot nicer once
formatted, this page is just for reference, as it isn't well documented).
Each test case is surrounded by `<|--` and `--|>`, which is the VPL syntax for showing a case in the output. The case title is prefixed with `-`, which applies the title formatting (usually a darker background). The section titles are surrounded with `---`, and the code lines (monospaced) start with a `>`. The VPL formats this output to make it presentable.
Here is a sample showing most of the variations for the output.
```
<|--
-Test 1
Incorrect program output
--- Input ---
>52
>50
--- Output ---
>a+b = 102
--- Output (normalized) ---
>a+b = 102
> ^ incorrect expected " ", found "+"
--- Expected Output ---
>a + b = 102
--- Expected Output (normalized) ---
>a + b = 102
--|>
<|--
-Test 2
Incorrect program output
--- Input ---
>45
>97
--- Output ---
>a+b = 142
--- Output (normalized) ---
>a+b = 142
> ^ incorrect expected " ", found "+"
--- Expected Output ---
>a + b = 142
--- Expected Output (normalized) ---
>a + b = 142
--|>
<|--
-Test 3
Correct program output
Good job
--- Input ---
>57
>4
--- Output ---
> a + b = 61
--- Output (normalized) ---
>a + b = 61
--- Expected Output ---
>a + b = 61
--- Expected Output (normalized) ---
>a + b = 61
--|>
<|--
-Test 4
Correct program output
Good job
--- Input ---
>46
>34
--- Output ---
> a + b = 80
--- Output (normalized) ---
>a + b = 80
--- Expected Output ---
>a + b = 80
--- Expected Output (normalized) ---
>a + b = 80
--|>
<|--
-Test 5
Correct program output
Good job
--- Input ---
>12
>38
--- Output ---
> a + b = 50
--- Output (normalized) ---
>a + b = 50
--- Expected Output ---
>a + b = 50
--- Expected Output (normalized) ---
>a + b = 50
--|>
<|--
-Test 6
Correct program output
Good job
--- Input ---
>62
>79
--- Output ---
> a + b = 141
--- Output (normalized) ---
>a + b = 141
--- Expected Output ---
>a + b = 141
--- Expected Output (normalized) ---
>a + b = 141
--|>
<|--
-Test 7
Incorrect program output
--- Input ---
>60
>18
--- Output ---
>a+b = 78
--- Output (normalized) ---
>a+b = 78
> ^ incorrect expected " ", found "+"
--- Expected Output ---
>a + b = 78
--- Expected Output (normalized) ---
>a + b = 78
--|>
<|--
-Test 8
Incorrect program output
--- Input ---
>97
>82
--- Output ---
> a + b = 179
--- Output (normalized) ---
>a + b = 179
> ^ incorrect expected "6", found "7"
--- Expected Output ---
>a + b = 169
--- Expected Output (normalized) ---
>a + b = 169
--|>
<|--
-Test 9
Incorrect program output
--- Input ---
>80
>23
--- Output ---
> a + b = 103
--- Output (normalized) ---
>a + b = 103
> ^ incorrect expected "9", found "1"
--- Expected Output ---
>a + b = 93
--- Expected Output (normalized) ---
>a + b = 93
--|>
<|--
-Test 10
Correct program output
Good job
--- Input ---
>48
>69
--- Output ---
> a + b = 117
--- Output (normalized) ---
>a + b = 117
--- Expected Output ---
>a + b = 117
--- Expected Output (normalized) ---
>a + b = 117
--|>
<|--
-Summary of tests
>+-------------------------------+
>| 10 tests run, 5 tests passed |
>+-------------------------------+
--|>
```

Loading…
Cancel
Save