feat: reorganize workbook into 3 tracks (core, engineering-2026, ecosystems)
This commit is contained in:
1 parent
82677455b2
commit
2e002b6176
64 files changed
+2295
-196
No files matched your search
@@ -0,0 +1,39 @@
|
||||
#![allow(unused_variables, dead_code)]
|
||||
|
||||
pub fn sum_of_even_squares(nums: &[i32]) -> i32 {
|
||||
todo!("Użyj iter().filter(...).map(...).sum()")
|
||||
}
|
||||
|
||||
pub fn filter_and_transform<F>(items: &[i32], predicate: F) -> Vec<i32>
|
||||
where
|
||||
F: Fn(i32) -> bool,
|
||||
{
|
||||
todo!("Odfiltruj items przez predicate i pomnóż każdy przez 2")
|
||||
}
|
||||
|
||||
pub fn non_empty_trimmed(lines: &[&str]) -> Vec<String> {
|
||||
todo!("Przytnij białe znaki i zwróć tylko niepuste linie jako Vec<String>")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn sums_even_squares() {
|
||||
assert_eq!(sum_of_even_squares(&[1, 2, 3, 4, 5]), 20);
|
||||
assert_eq!(sum_of_even_squares(&[1, 3, 5]), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn applies_closure_predicate() {
|
||||
let result = filter_and_transform(&[1, 5, 10, 15], |x| x >= 5);
|
||||
assert_eq!(result, vec![10, 20, 30]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn trims_and_drops_empty_lines() {
|
||||
let input = [" rust ", "", " ", "\tcargo\n"];
|
||||
assert_eq!(non_empty_trimmed(&input), vec!["rust", "cargo"]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user