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