Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/example_tests/input/A1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
4 7
1 0 1
0 0 1
0 2 3
1 0 1
1 1 2
0 0 2
1 1 3
4 changes: 4 additions & 0 deletions tests/example_tests/input/A1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0
1
0
1
7 changes: 7 additions & 0 deletions tests/example_tests/input/B1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
5 5
1 2 3 4 5
1 0 5
1 2 4
0 3 10
1 0 5
1 0 3
4 changes: 4 additions & 0 deletions tests/example_tests/input/B1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
15
7
25
6
6 changes: 6 additions & 0 deletions tests/example_tests/input/C1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
5
4 10 6 3
6 5 4 3
1 1 0 0
31415 92653 58979 32384
1000000000 1000000000 999999999 999999999
5 changes: 5 additions & 0 deletions tests/example_tests/input/C1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
3
13
0
314095480
499999999500000000
4 changes: 4 additions & 0 deletions tests/example_tests/input/D1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3 3
#..
..#
...
4 changes: 4 additions & 0 deletions tests/example_tests/input/D1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3
#><
><#
><.
4 changes: 4 additions & 0 deletions tests/example_tests/input/E1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3 1
5 3 2
1 4 8
7 6 9
4 changes: 4 additions & 0 deletions tests/example_tests/input/E1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
19
X..
..X
.X.
4 changes: 4 additions & 0 deletions tests/example_tests/input/E2_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3 2
10 10 1
10 10 1
1 1 10
4 changes: 4 additions & 0 deletions tests/example_tests/input/E2_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
50
XX.
XX.
..X
3 changes: 3 additions & 0 deletions tests/example_tests/input/F1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
4 5
1 2 3 4
5 6 7 8 9
1 change: 1 addition & 0 deletions tests/example_tests/input/F1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5 16 34 60 70 70 59 36
3 changes: 3 additions & 0 deletions tests/example_tests/input/F2_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1 1
10000000
10000000
1 change: 1 addition & 0 deletions tests/example_tests/input/F2_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
871938225
8 changes: 8 additions & 0 deletions tests/example_tests/input/G1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
6 7
1 4
5 2
3 0
5 5
4 1
0 3
4 2
5 changes: 5 additions & 0 deletions tests/example_tests/input/G1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
4
1 5
2 1 4
1 2
2 0 3
4 changes: 4 additions & 0 deletions tests/example_tests/input/H1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3 2
1 4
2 5
0 6
4 changes: 4 additions & 0 deletions tests/example_tests/input/H1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Yes
4
2
0
4 changes: 4 additions & 0 deletions tests/example_tests/input/H2_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3 3
1 4
2 5
0 6
1 change: 1 addition & 0 deletions tests/example_tests/input/H2_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No
1 change: 1 addition & 0 deletions tests/example_tests/input/I1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abcbcba
1 change: 1 addition & 0 deletions tests/example_tests/input/I1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21
1 change: 1 addition & 0 deletions tests/example_tests/input/I2_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mississippi
1 change: 1 addition & 0 deletions tests/example_tests/input/I2_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
53
1 change: 1 addition & 0 deletions tests/example_tests/input/I3_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ababacaca
1 change: 1 addition & 0 deletions tests/example_tests/input/I3_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/example_tests/input/I4_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aaaaa
1 change: 1 addition & 0 deletions tests/example_tests/input/I4_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
7 changes: 7 additions & 0 deletions tests/example_tests/input/J1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
5 5
1 2 3 2 1
2 1 5
3 2 3
1 3 1
2 2 4
3 1 3
4 changes: 4 additions & 0 deletions tests/example_tests/input/J1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3
3
2
6
9 changes: 9 additions & 0 deletions tests/example_tests/input/K1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
5 7
1 2 3 4 5
1 0 5
0 2 4 100 101
1 0 3
0 1 3 102 103
1 2 5
0 2 5 104 105
1 0 5
4 changes: 4 additions & 0 deletions tests/example_tests/input/K1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
15
404
41511
4317767
7 changes: 7 additions & 0 deletions tests/example_tests/input/L1_in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
5 5
0 1 0 0 1
2 1 5
1 3 4
2 2 5
1 1 3
2 1 2
3 changes: 3 additions & 0 deletions tests/example_tests/input/L1_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
2
0
1
37 changes: 37 additions & 0 deletions tests/example_tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pathlib import Path

import pytest

import util


class TestExamples:
@pytest.mark.parametrize('problem_id, source', (
('A', 'dsu_practice.py'),
('B', 'fenwick_practice.py'),
('C', 'floor_sum_practice.py'),
('D', 'maxflow_practice.py'),
('E', 'mincostflow_practice.py'),
('F', 'convolution_practice.py'),
('F', 'convolution_practice_int.py'),
('G', 'scc_practice.py'),
('H', 'twosat_practice.py'),
('I', 'sa_practice.py'),
('J', 'segtree_practice.py'),
('J', 'segtree_practice_reversed.py'),
('K', 'lazysegtree_practice_k.py'),
('K', 'lazysegtree_practice_k_wo_modint.py'),
('L', 'lazysegtree_practice_l.py')))
def test_examples(self, problem_id, source) -> None:
input_path = (Path(__file__).parent / 'input')
stdin_paths = list(input_path.glob(f'{problem_id}*_in.txt'))
stdout_paths = list(input_path.glob(f'{problem_id}*_out.txt'))
stdin_paths.sort()
stdout_paths.sort()

for stdin_path, stdout_path in zip(stdin_paths, stdout_paths):
with open(stdin_path) as stdin:
output = util.run(source, stdin).decode()

with open(stdout_path) as stdout:
assert output == stdout.read()
8 changes: 8 additions & 0 deletions tests/example_tests/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pathlib import Path
from subprocess import check_output
import sys


def run(source, stdin):
source_path = Path(__file__).parent.parent.parent / 'example' / source
return check_output((sys.executable, source_path), stdin=stdin)