Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

task3.rs 810B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. extern crate task3;
  2. #[test]
  3. fn test_one_char() {
  4. assert_eq!(
  5. 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!(
  12. task3::count(
  13. "♥ The quick brown fox jumps over the lazy dog. ♥",
  14. '♥',
  15. ),
  16. 2
  17. );
  18. }
  19. #[test]
  20. #[should_panic]
  21. fn test_wrong() {
  22. assert_eq!(
  23. task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'c'),
  24. 2
  25. );
  26. }
  27. #[test]
  28. fn test_four_char() {
  29. assert_eq!(
  30. task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", 'o'),
  31. 4
  32. );
  33. }
  34. #[test]
  35. fn test_no_char() {
  36. assert_eq!(
  37. task3::count("♥ The quick brown fox jumps over the lazy dog. ♥", '!'),
  38. 0
  39. );
  40. }