Skip to content

Commit

Permalink
rust/scrabble-score: 2nd iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Sep 18, 2023
1 parent 56fb50b commit 03a3fc4
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 180 deletions.
87 changes: 45 additions & 42 deletions rust/scrabble-score/coverage-annotations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,54 @@
11| |/// assert_eq!(got, want);
12| |/// ```
13| 42|pub fn score(word: &str) -> u64 {
14| 42| let mut result: u64 = 0;
15| 42|
16| 42| let binding = word.to_lowercase();
17| 42| let letters: &str = binding.trim();
18| |
19| 258| for letter in letters.chars() {
^42
20| 258| result += match letter {
21| 165| 'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1,
22| 6| 'd' | 'g' => 2,
23| 24| 'b' | 'c' | 'm' | 'p' => 3,
24| 27| 'f' | 'h' | 'v' | 'w' | 'y' => 4,
25| 6| 'k' => 5,
26| 9| 'j' | 'x' => 8,
27| 15| 'q' | 'z' => 10,
28| 6| _ => 0,
29| | };
30| | }
31| |
32| 42| result
33| 42|}
14| 42| word.to_lowercase()
15| 42| .trim()
16| 42| .chars()
17| 258| .map(|c| match c {
18| 165| 'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1,
19| 6| 'd' | 'g' => 2,
20| 24| 'b' | 'c' | 'm' | 'p' => 3,
21| 27| 'f' | 'h' | 'v' | 'w' | 'y' => 4,
22| 6| 'k' => 5,
23| 9| 'j' | 'x' => 8,
24| 15| 'q' | 'z' => 10,
25| 6| _ => 0,
26| 258| })
------------------
| scrabble_score::score::{closure#0}:
| 17| 258| .map(|c| match c {
| 18| 165| 'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1,
| 19| 6| 'd' | 'g' => 2,
| 20| 24| 'b' | 'c' | 'm' | 'p' => 3,
| 21| 27| 'f' | 'h' | 'v' | 'w' | 'y' => 4,
| 22| 6| 'k' => 5,
| 23| 9| 'j' | 'x' => 8,
| 24| 15| 'q' | 'z' => 10,
| 25| 6| _ => 0,
| 26| 258| })
------------------
| Unexecuted instantiation: scrabble_score::score::{closure#0}
------------------
27| 42| .sum()
28| 42|}
------------------
| scrabble_score::score:
| 13| 42|pub fn score(word: &str) -> u64 {
| 14| 42| let mut result: u64 = 0;
| 15| 42|
| 16| 42| let binding = word.to_lowercase();
| 17| 42| let letters: &str = binding.trim();
| 18| |
| 19| 258| for letter in letters.chars() {
| ^42
| 20| 258| result += match letter {
| 21| 165| 'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1,
| 22| 6| 'd' | 'g' => 2,
| 23| 24| 'b' | 'c' | 'm' | 'p' => 3,
| 24| 27| 'f' | 'h' | 'v' | 'w' | 'y' => 4,
| 25| 6| 'k' => 5,
| 26| 9| 'j' | 'x' => 8,
| 27| 15| 'q' | 'z' => 10,
| 28| 6| _ => 0,
| 29| | };
| 30| | }
| 31| |
| 32| 42| result
| 33| 42|}
| 14| 42| word.to_lowercase()
| 15| 42| .trim()
| 16| 42| .chars()
| 17| 42| .map(|c| match c {
| 18| | 'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1,
| 19| | 'd' | 'g' => 2,
| 20| | 'b' | 'c' | 'm' | 'p' => 3,
| 21| | 'f' | 'h' | 'v' | 'w' | 'y' => 4,
| 22| | 'k' => 5,
| 23| | 'j' | 'x' => 8,
| 24| | 'q' | 'z' => 10,
| 25| | _ => 0,
| 26| 42| })
| 27| 42| .sum()
| 28| 42|}
------------------
| Unexecuted instantiation: scrabble_score::score
------------------
4 changes: 2 additions & 2 deletions rust/scrabble-score/coverage-missing-lines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Running: cargo llvm-cov --no-clean --all-features --workspace --show-missing-lin

Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/home/vpayno/git_vpayno/exercism-workspace/rust/scrabble-score/src/lib.rs 13 0 100.00% 1 0 100.00% 17 0 100.00% 0 0 -
/home/vpayno/git_vpayno/exercism-workspace/rust/scrabble-score/src/lib.rs 12 0 100.00% 2 0 100.00% 18 0 100.00% 0 0 -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL 13 0 100.00% 1 0 100.00% 17 0 100.00% 0 0 -
TOTAL 12 0 100.00% 2 0 100.00% 18 0 100.00% 0 0 -

33 changes: 18 additions & 15 deletions rust/scrabble-score/report.lcov
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
SF:/home/vpayno/git_vpayno/exercism-workspace/rust/scrabble-score/src/lib.rs
FN:17,_RNCNvCsbE52QhvtJFr_14scrabble_score5score0B3_
FN:13,_RNvCsbE52QhvtJFr_14scrabble_score5score
FN:17,_RNCNvCsfA8C7faOhHu_14scrabble_score5score0B3_
FN:13,_RNvCsfA8C7faOhHu_14scrabble_score5score
FNDA:86,_RNCNvCsbE52QhvtJFr_14scrabble_score5score0B3_
FNDA:14,_RNvCsbE52QhvtJFr_14scrabble_score5score
FNDA:0,_RNCNvCsfA8C7faOhHu_14scrabble_score5score0B3_
FNDA:0,_RNvCsfA8C7faOhHu_14scrabble_score5score
FNF:1
FNH:1
FNF:2
FNH:2
DA:13,14
DA:14,14
DA:15,14
DA:16,14
DA:17,14
DA:19,86
DA:20,86
DA:21,55
DA:17,86
DA:18,55
DA:19,2
DA:20,8
DA:21,9
DA:22,2
DA:23,8
DA:24,9
DA:23,3
DA:24,5
DA:25,2
DA:26,3
DA:27,5
DA:28,2
DA:32,14
DA:33,14
DA:26,86
DA:27,14
DA:28,14
BRF:0
BRH:0
LF:17
LH:17
LF:18
LH:18
end_of_record
Loading

0 comments on commit 03a3fc4

Please sign in to comment.