Skip to content

Commit

Permalink
introduce test_generator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
witek-formanski committed Oct 30, 2023
1 parent 2a45a2c commit 3acb625
Show file tree
Hide file tree
Showing 602 changed files with 629 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
IFS=$','
for TEST_CASE in ${TEST_CASES[@]}; do
TEST_NAME=$(echo "$TEST_CASE" | cut -d ':' -f 1)
TEST_VALUE=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running tests for $TEST_NAME with value $TEST_VALUE"
TEST_NUMBER=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running $TEST_NUMBER tests for $TEST_NAME"
python scripts/builder.py "${TEST_NAME}.cpp"
python scripts/tester.py "${TEST_NAME}.cpp" "$TEST_VALUE"
python scripts/tester.py "${TEST_NAME}.cpp" "$TEST_NUMBER"
done
- name: Detect tests for C
Expand All @@ -44,17 +44,17 @@ jobs:
echo "Test Results:"
echo "$TEST_RESULTS"
echo "::set-output name=test_results::$TEST_RESULTS"
- name: Test C code
run: |
TEST_CASES=($(echo "${{steps.detect_tests_c.outputs.test_results}}" | tr ',' '\n'))
IFS=$','
for TEST_CASE in ${TEST_CASES[@]}; do
TEST_NAME=$(echo "$TEST_CASE" | cut -d ':' -f 1)
TEST_VALUE=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running tests for $TEST_NAME with value $TEST_VALUE"
TEST_NUMBER=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running $TEST_NUMBER tests for $TEST_NAME"
python scripts/builder.py "${TEST_NAME}.c"
python scripts/tester.py "${TEST_NAME}.c" "$TEST_VALUE"
python scripts/tester.py "${TEST_NAME}.c" "$TEST_NUMBER"
done
- name: Test manually
Expand Down
22 changes: 22 additions & 0 deletions scripts/test_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
import sys
import csv

source_path = sys.argv[1]
source_name = source_path.split(".")[0]
source_extension = source_path.split(".")[1]

destination_file = sys.argv[2]
destination_name = destination_file.split(".")[0]
destination_extension = destination_file.split(".")[1]

if source_extension == 'csv':
with open(source_path, 'r') as csvfile:
csvreader = csv.reader(csvfile)
data = list(csvreader)

for i, row in enumerate(data):
with open(f'tests/{destination_extension}/{destination_name}{i}.in', 'w') as infile:
infile.write(row[0])
with open(f'tests/{destination_extension}/{destination_name}{i}.out', 'w') as outfile:
outfile.write(row[1])
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute0.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute0.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute10.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute10.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute100.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
101
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute100.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute101.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
102
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute101.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute102.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
103
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute102.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute103.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
104
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute103.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute104.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
105
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute104.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute105.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
106
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute105.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute106.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
107
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute106.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute107.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
108
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute107.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute108.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
109
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute108.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute109.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
110
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute109.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute11.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute11.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute110.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
111
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute110.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute111.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
112
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute111.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute112.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
113
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute112.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute113.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
114
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute113.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute114.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
115
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute114.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute115.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
116
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute115.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute116.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
117
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute116.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute117.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
118
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute117.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute118.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
119
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute118.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute119.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
120
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute119.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute12.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
13
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute12.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute120.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
121
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute120.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute121.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
122
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute121.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute122.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
123
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute122.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute123.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
124
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute123.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute124.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
125
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute124.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute125.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
126
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute125.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute126.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
127
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute126.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute127.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
128
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute127.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
34
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute128.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
129
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute128.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
35
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute129.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
130
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute129.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
36
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute13.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute13.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute130.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
131
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute130.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
36
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute131.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
132
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute131.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
37
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute132.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
133
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute132.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
38
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute133.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
134
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute133.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
38
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute134.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
135
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute134.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
38
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute135.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
136
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute135.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
39
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute136.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
137
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute136.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
40
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute137.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
138
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute137.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
41
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute138.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
139
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute138.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
41
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute139.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
140
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute139.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
41
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute14.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute14.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute140.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
141
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute140.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
41
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute141.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
142
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute141.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
41
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute142.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
143
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute142.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
41
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute143.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
144
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute143.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
42
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute144.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
145
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute144.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
43
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute145.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
146
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute145.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
44
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute146.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
147
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute146.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
44
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute147.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
148
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute147.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
45
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute148.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
149
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute148.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
46
1 change: 1 addition & 0 deletions tests/c/count_sparse_numbers_brute149.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
150
Loading

0 comments on commit 3acb625

Please sign in to comment.