Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testsuite: add rust generator test #1154

Merged
merged 1 commit into from
Dec 27, 2023
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
2 changes: 1 addition & 1 deletion testsuite/rust_bridged/tests/empty/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ language: RUST
time: 2
memory: 65536
source: empty.rs
expect: [WA, WA]
expect: WA
1 change: 1 addition & 0 deletions testsuite/rust_generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This test checks that a generator, using rand, can be compiled and run in Rust.
14 changes: 14 additions & 0 deletions testsuite/rust_generator/generator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use rand::{Rng, SeedableRng};

type ConcreteRng = rand_xoshiro::Xoshiro256PlusPlus;

fn main() {
let mut args = std::env::args();
args.next();
let mut rng = ConcreteRng::seed_from_u64(args.next().unwrap().parse().unwrap());

let x = rng.gen_range(0..10);
let y = rng.gen_range(0..10);
println!("{x} {y}");
eprintln!("{}", x + y);
}
5 changes: 5 additions & 0 deletions testsuite/rust_generator/init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
generator: generator.rs
test_cases:
- {generator_args: [1], points: 10}
- {generator_args: [2], points: 10}
- {generator_args: [3], points: 30}
2 changes: 2 additions & 0 deletions testsuite/rust_generator/tests/AC/sol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x, y = map(int, input().split())
print(x + y)
5 changes: 5 additions & 0 deletions testsuite/rust_generator/tests/AC/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: PY3
time: 2
memory: 65536
source: sol.py
expect: AC
Loading