🎉 initial commit
This commit is contained in:
19
test_data/complex_example.rs.snap
Normal file
19
test_data/complex_example.rs.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::collections::HashMap;
|
||||
fn process_data(data: Vec<i32>) -> HashMap<i32, i32> {
|
||||
let mut result = HashMap::new();
|
||||
for (index, value) in data.iter().enumerate() {
|
||||
result.insert(index as i32, *value * 2);
|
||||
}
|
||||
result
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn test_process_data() {
|
||||
let input = vec![1, 2, 3, 4, 5];
|
||||
let result = process_data(input);
|
||||
assert_eq!(result.get(& 0), Some(& 2));
|
||||
assert_eq!(result.get(& 1), Some(& 4));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user