Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MasloMaslane committed Oct 18, 2023
1 parent 8bb0a36 commit 6400871
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tests/commands/run/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
@pytest.mark.parametrize("create_package", [get_simple_package_path(), get_verify_status_package_path(),
get_checker_package_path(), get_library_package_path(),
get_library_string_args_package_path(), get_limits_package_path(),
get_override_limits_package_path(), get_icpc_package_path()],
get_override_limits_package_path(), get_icpc_package_path(),
get_large_output_package_path()],
indirect=True)
def test_simple(create_package, time_tool):
"""
Expand Down Expand Up @@ -70,7 +71,8 @@ def test_wrong_solution(create_package, time_tool):
@pytest.mark.parametrize("create_package", [get_simple_package_path(), get_verify_status_package_path(),
get_checker_package_path(), get_library_package_path(),
get_library_string_args_package_path(), get_limits_package_path(),
get_override_limits_package_path(), get_icpc_package_path()],
get_override_limits_package_path(), get_icpc_package_path(),
get_large_output_package_path()],
indirect=True)
def test_no_expected_scores(capsys, create_package, time_tool):
"""
Expand Down Expand Up @@ -106,7 +108,8 @@ def test_no_expected_scores(capsys, create_package, time_tool):
@pytest.mark.parametrize("create_package", [get_simple_package_path(), get_verify_status_package_path(),
get_checker_package_path(), get_library_package_path(),
get_library_string_args_package_path(), get_limits_package_path(),
get_override_limits_package_path(), get_icpc_package_path()],
get_override_limits_package_path(), get_icpc_package_path(),
get_large_output_package_path()],
indirect=True)
def test_apply_suggestions(create_package, time_tool):
"""
Expand Down
13 changes: 13 additions & 0 deletions tests/packages/large_output/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: Package with large outputs
sinol_task_id: lou
memory_limit: 16000
time_limit: 2000
sinol_expected_scores:
lou.cpp:
expected:
0: {points: 0, status: OK}
points: 0
lou1.cpp:
expected:
0: {points: 0, status: WA}
points: 0
1 change: 1 addition & 0 deletions tests/packages/large_output/in/lou0.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Empty file.
11 changes: 11 additions & 0 deletions tests/packages/large_output/prog/lou.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <bits/stdc++.h>

using namespace std;

int main() {
int bytes_to_write = (1 << 16) + 1;
for (int i = 0; i < bytes_to_write; i++) {
cout << "x";
}
return 0;
}
11 changes: 11 additions & 0 deletions tests/packages/large_output/prog/lou1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <bits/stdc++.h>

using namespace std;

int main() {
int bytes_to_write = (1 << 20);
for (int i = 0; i < bytes_to_write; i++) {
cout << "x";
}
return 0;
}
11 changes: 10 additions & 1 deletion tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,20 @@ def get_icpc_package_path():
return os.path.join(os.path.dirname(__file__), "packages", "icpc")


def get_large_output_package_path():
"""
Get path to package with large output (/tests/packages/large_output)
"""
return os.path.join(os.path.dirname(__file__), "packages", "large_output")

def create_ins(package_path, task_id):
"""
Create .in files for package.
"""
ingen = package_util.get_files_matching_pattern(task_id, f'{task_id}ingen.*')[0]
all_ingens = package_util.get_files_matching_pattern(task_id, f'{task_id}ingen.*')
if len(all_ingens) == 0:
return
ingen = all_ingens[0]
ingen_executable = paths.get_executables_path("ingen.e")
os.makedirs(paths.get_executables_path(), exist_ok=True)
assert compile.compile(ingen, ingen_executable)
Expand Down

0 comments on commit 6400871

Please sign in to comment.