diff --git a/testsuite/rust_generator/README.md b/testsuite/rust_generator/README.md new file mode 100644 index 000000000..32e3f164a --- /dev/null +++ b/testsuite/rust_generator/README.md @@ -0,0 +1 @@ +This test checks that a generator, using rand, can be compiled and run in Rust. diff --git a/testsuite/rust_generator/generator.rs b/testsuite/rust_generator/generator.rs new file mode 100644 index 000000000..2cc3a971e --- /dev/null +++ b/testsuite/rust_generator/generator.rs @@ -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); +} diff --git a/testsuite/rust_generator/init.yml b/testsuite/rust_generator/init.yml new file mode 100644 index 000000000..34f86bfa2 --- /dev/null +++ b/testsuite/rust_generator/init.yml @@ -0,0 +1,5 @@ +generator: generator.rs +test_cases: +- {generator_args: [1], points: 10} +- {generator_args: [2], points: 10} +- {generator_args: [3], points: 30} diff --git a/testsuite/rust_generator/tests/AC/sol.py b/testsuite/rust_generator/tests/AC/sol.py new file mode 100644 index 000000000..3bd0380cc --- /dev/null +++ b/testsuite/rust_generator/tests/AC/sol.py @@ -0,0 +1,2 @@ +x, y = map(int, input().split()) +print(x + y) diff --git a/testsuite/rust_generator/tests/AC/test.yml b/testsuite/rust_generator/tests/AC/test.yml new file mode 100644 index 000000000..600fbc723 --- /dev/null +++ b/testsuite/rust_generator/tests/AC/test.yml @@ -0,0 +1,5 @@ +language: PY3 +time: 2 +memory: 65536 +source: sol.py +expect: [AC, AC, AC]