re: Daily Challenge #3 - Vowel Counter VIEW POST


Oh I've been waiting for this one all morning! Decided I wanted to go all out on this on!

  • Rust
  • TDD
  • AND a Live Stream!

Come check it out while I work my way through this challenge! I'm live now and about to get started!


Here is my Rust solution all TDD'ed out!

extern crate lazy_static;

pub fn vowel_count(some_string: &str) -> usize {
    lazy_static! {
        static ref VOWELS: Vec<char> = vec!['a', 'e', 'i', 'o', 'u'];

        .filter(|c| VOWELS.contains(c))

mod tests {
    use crate::vowel_count;

    fn it_works_with_an_empty_string() {
        assert_eq!(vowel_count(""), 0);

    fn it_works_non_vowel_strings() {
        assert_eq!(vowel_count("d"), 0);
        assert_eq!(vowel_count("drthpCVM  *&^"), 0);
        assert_eq!(vowel_count("1234567890!@#$%^&*()--__+="), 0);
        assert_eq!(vowel_count("NPlkv.,<>?/"), 0);

    fn it_works_for_strings_of_just_vowels() {
        assert_eq!(vowel_count("a"), 1);
        assert_eq!(vowel_count("A"), 1);
        assert_eq!(vowel_count("AaeEiIoOuU"), 10);
        assert_eq!(vowel_count("eoiuioEAUIAEoieaiAoe"), 20);

    fn it_works_for_mixed_strings() {
        assert_eq!(vowel_count("deadpool"), 4);
            vowel_count("This is just a sentence! With some words and symbols #$%"),
        assert_eq!(vowel_count("TESTING OUT YELLING WITH ALL CAPS"), 9);
            vowel_count("!@#      \nThis is THE MOST COMPLICATED test SoO farrrr"),

I'm still live streaming as I type this out, but once I wrap up I'll post a link to the video here!


Ahhh! :panic:

Turns out OBS didn't want to behave for me today, and split my stream into 2 and dies before I finished, but we got almost all of it recorded! Learnings for next stream!

Links to the video that recorded for the longest here

code of conduct - report abuse