mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-05-15 17:58:44 +00:00
23 lines
480 B
Rust
23 lines
480 B
Rust
fn elems_to_vec(a: i32, b: i32, c: i32) -> Vec<i32> {
|
|
// TODO: Return a vector containing the elements a, b and c (in this order).
|
|
// Use the "vec!" macro.
|
|
}
|
|
|
|
fn main() {
|
|
// You can optionally experiment here.
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn test_elems_to_vec() {
|
|
let (a, b, c) = (2, 7, 12);
|
|
let v = elems_to_vec(a, b, c);
|
|
assert_eq!(v[0], a);
|
|
assert_eq!(v[1], b);
|
|
assert_eq!(v[2], c);
|
|
}
|
|
}
|