|
|
@@ -2,32 +2,44 @@ extern crate task3;
|
|
2
|
2
|
|
|
3
|
3
|
#[test]
|
|
4
|
4
|
fn test_one_char() {
|
|
5
|
|
- assert_eq!(task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'T'),
|
|
6
|
|
- 1);
|
|
|
5
|
+ assert_eq!(
|
|
|
6
|
+ task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'T'),
|
|
|
7
|
+ 1
|
|
|
8
|
+ );
|
|
7
|
9
|
}
|
|
8
|
10
|
|
|
9
|
11
|
#[test]
|
|
10
|
12
|
fn test_two_char() {
|
|
11
|
|
- assert_eq!(task3::count("♥ The quick brown fox jumps over the lazy dog. ♥",
|
|
12
|
|
- '♥'),
|
|
13
|
|
- 2);
|
|
|
13
|
+ assert_eq!(
|
|
|
14
|
+ task3::count(
|
|
|
15
|
+ "♥ The quick brown fox jumps over the lazy dog. ♥",
|
|
|
16
|
+ '♥',
|
|
|
17
|
+ ),
|
|
|
18
|
+ 2
|
|
|
19
|
+ );
|
|
14
|
20
|
}
|
|
15
|
21
|
|
|
16
|
22
|
#[test]
|
|
17
|
23
|
#[should_panic]
|
|
18
|
24
|
fn test_wrong() {
|
|
19
|
|
- assert_eq!(task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'c'),
|
|
20
|
|
- 2);
|
|
|
25
|
+ assert_eq!(
|
|
|
26
|
+ task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'c'),
|
|
|
27
|
+ 2
|
|
|
28
|
+ );
|
|
21
|
29
|
}
|
|
22
|
30
|
|
|
23
|
31
|
#[test]
|
|
24
|
32
|
fn test_four_char() {
|
|
25
|
|
- assert_eq!(task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'o'),
|
|
26
|
|
- 4);
|
|
|
33
|
+ assert_eq!(
|
|
|
34
|
+ task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'o'),
|
|
|
35
|
+ 4
|
|
|
36
|
+ );
|
|
27
|
37
|
}
|
|
28
|
38
|
|
|
29
|
39
|
#[test]
|
|
30
|
40
|
fn test_no_char() {
|
|
31
|
|
- assert_eq!(task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", '!'),
|
|
32
|
|
- 0);
|
|
|
41
|
+ assert_eq!(
|
|
|
42
|
+ task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", '!'),
|
|
|
43
|
+ 0
|
|
|
44
|
+ );
|
|
33
|
45
|
}
|