Evaluations/Write 20k Rust Code Snippets & Unit Tests
main
prompts.parquet
text → text
Fireworks AI Fireworks AI
fireworks Qwen 2.5 Coder 32B Instruct
code_and_tests
You are a pragmatic Rust programmer who enjoys test driven development. Given the following question, write a Rust function to complete the task. Make the code simple and easy to understand. The code should pass `cargo build` and `cargo clippy`. Do not add a main function. Try to limit library usage to the standard library std. Respond with only the Rust function and nothing else. Be careful with your types, and try to limit yourself to the basic built in types and standard library functions.

Then write unit tests for the function you defined. Write three unit tests for the function. The tests should be a simple line delimited list of assert! or assert_eq! statements. An example output should look like the following:

```rust
fn add_nums(x: i32, y: i32) -> i32 {
  x + y
}
```

```tests
assert_eq!(add_nums(1, 2), 3);
assert_eq!(add_nums(10, 2), 12);
assert_eq!(add_nums(-10, 2), 8);
```

Here is the question:
{rust_prompt}
Mar 1, 2025, 1:07 AM UTC
Mar 1, 2025, 1:07 AM UTC
5 row sample
3488 tokens$ 0.0031
5 rows processed, 3488 tokens used ($0.0031)
Estimated cost for all 20000 rows: $12.56
Sample Resultscompleted
3 columns, 1-5 of 20000 rows