From 321824babf4c5e7fd8640d7066c4228f81178a70 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Mon, 11 Sep 2023 20:26:56 +0200 Subject: [PATCH] Remove test_ prefix from tests closes #1720 --- .../concept/csv-builder/tests/csv-builder.rs | 10 +- .../tests/health-statistics.rs | 10 +- .../magazine-cutout/tests/magazine-cutout.rs | 12 +- .../resistor-color/tests/resistor-color.rs | 16 +-- .../tests/role-playing-game.rs | 16 +-- .../rpn-calculator/tests/rpn-calculator.rs | 22 ++-- .../short-fibonacci/tests/short-fibonacci.rs | 8 +- .../practice/alphametics/tests/alphametics.rs | 20 ++-- exercises/practice/anagram/tests/anagram.rs | 28 ++--- .../tests/armstrong-numbers.rs | 26 ++--- .../atbash-cipher/tests/atbash-cipher.rs | 28 ++--- .../practice/beer-song/tests/beer-song.rs | 12 +- .../bob/.articles/performance/code/main.rs | 6 +- .../bob/.articles/performance/content.md | 6 +- .../bob/.articles/performance/snippet.md | 6 +- exercises/practice/bob/tests/bob.rs | 50 ++++---- .../practice/book-store/tests/book-store.rs | 28 ++--- exercises/practice/clock/tests/clock.rs | 108 +++++++++--------- .../tests/collatz-conjecture.rs | 14 +-- .../crypto-square/tests/crypto-square.rs | 14 +-- exercises/practice/decimal/.meta/example.rs | 2 +- exercises/practice/decimal/tests/decimal.rs | 86 +++++++------- exercises/practice/diamond/tests/diamond.rs | 10 +- .../tests/difference-of-squares.rs | 18 +-- .../diffie-hellman/tests/diffie-hellman.rs | 18 +-- exercises/practice/dot-dsl/tests/dot-dsl.rs | 18 +-- exercises/practice/etl/tests/etl.rs | 8 +- exercises/practice/fizzy/.meta/example.rs | 14 +-- exercises/practice/fizzy/tests/fizzy.rs | 14 +-- .../practice/gigasecond/tests/gigasecond.rs | 10 +- .../grade-school/tests/grade-school.rs | 18 +-- .../grains/.articles/performance/code/main.rs | 12 +- .../grains/.articles/performance/content.md | 12 +- .../grains/.articles/performance/snippet.md | 12 +- exercises/practice/grains/tests/grains.rs | 28 ++--- exercises/practice/grep/tests/grep.rs | 64 +++++------ exercises/practice/hamming/tests/hamming.rs | 26 ++--- .../practice/hello-world/GETTING_STARTED.md | 16 +-- .../practice/hello-world/tests/hello-world.rs | 2 +- .../practice/hexadecimal/tests/hexadecimal.rs | 20 ++-- .../practice/high-scores/tests/high-scores.rs | 22 ++-- .../isbn-verifier/tests/isbn-verifier.rs | 28 ++--- .../.articles/performance/code/main.rs | 12 +- .../isogram/.articles/performance/content.md | 12 +- .../isogram/.articles/performance/snippet.md | 12 +- .../tests/kindergarten-garden.rs | 34 +++--- exercises/practice/knapsack/tests/knapsack.rs | 14 +-- .../leap/.articles/performance/code/main.rs | 12 +- .../leap/.articles/performance/content.md | 12 +- .../leap/.articles/performance/snippet.md | 10 +- exercises/practice/leap/tests/leap.rs | 28 ++--- .../practice/luhn-from/tests/luhn-from.rs | 2 +- .../practice/luhn-trait/tests/luhn-trait.rs | 2 +- exercises/practice/luhn/tests/luhn.rs | 38 +++--- exercises/practice/macros/tests/macros.rs | 34 +++--- .../practice/nth-prime/tests/nth-prime.rs | 8 +- .../tests/nucleotide-codons.rs | 14 +-- .../tests/nucleotide-count.rs | 16 +-- exercises/practice/paasio/tests/paasio.rs | 16 +-- .../tests/palindrome-products.rs | 28 ++--- .../.articles/performance/code/main.rs | 8 +- .../pangram/.articles/performance/content.md | 8 +- .../pangram/.articles/performance/snippet.md | 8 +- .../tests/parallel-letter-frequency.rs | 20 ++-- .../phone-number/tests/phone-number.rs | 36 +++--- .../practice/pig-latin/tests/pig-latin.rs | 42 +++---- exercises/practice/poker/tests/poker.rs | 70 ++++++------ .../prime-factors/tests/prime-factors.rs | 14 +-- .../tests/protein-translation.rs | 24 ++-- exercises/practice/proverb/tests/proverb.rs | 12 +- .../tests/pythagorean-triplet.rs | 14 +-- .../tests/rail-fence-cipher.rs | 14 +-- exercises/practice/react/tests/react.rs | 2 +- .../practice/rectangles/tests/rectangles.rs | 22 ++-- .../reverse-string/tests/reverse-string.rs | 16 +-- .../tests/rna-transcription.rs | 20 ++-- .../practice/robot-name/tests/robot-name.rs | 14 +-- .../roman-numerals/tests/roman-numerals.rs | 22 ++-- .../tests/run-length-encoding.rs | 26 ++--- exercises/practice/say/tests/say.rs | 36 +++--- .../practice/scale-generator/.meta/example.rs | 6 +- .../scale-generator/tests/scale-generator.rs | 34 +++--- exercises/practice/series/tests/series.rs | 10 +- .../tests/simple-linked-list.rs | 18 +-- exercises/practice/sublist/tests/sublist.rs | 10 +- .../practice/two-bucket/tests/two-bucket.rs | 8 +- .../practice/word-count/tests/word-count.rs | 12 +- exercises/practice/yacht/tests/yacht.rs | 58 +++++----- rust-tooling/src/exercise_config.rs | 2 +- rust-tooling/src/problem_spec.rs | 2 +- rust-tooling/tests/bash_script_conventions.rs | 6 +- rust-tooling/tests/count_ignores.rs | 2 +- rust-tooling/tests/difficulties.rs | 2 +- .../tests/no_authors_in_cargo_toml.rs | 2 +- rust-tooling/tests/no_trailing_whitespace.rs | 2 +- 95 files changed, 899 insertions(+), 905 deletions(-) diff --git a/exercises/concept/csv-builder/tests/csv-builder.rs b/exercises/concept/csv-builder/tests/csv-builder.rs index ad4b4b79d..69f550cf7 100644 --- a/exercises/concept/csv-builder/tests/csv-builder.rs +++ b/exercises/concept/csv-builder/tests/csv-builder.rs @@ -1,7 +1,7 @@ use csv_builder::*; #[test] -fn test_no_escaping() { +fn no_escaping() { let mut builder = CsvRecordBuilder::new(); builder.add("ant"); @@ -15,7 +15,7 @@ fn test_no_escaping() { #[test] #[ignore] -fn test_quote() { +fn quote() { let mut builder = CsvRecordBuilder::new(); builder.add("ant"); @@ -28,7 +28,7 @@ fn test_quote() { #[test] #[ignore] -fn test_new_line() { +fn new_line() { let mut builder = CsvRecordBuilder::new(); builder.add("ant"); @@ -39,7 +39,7 @@ fn test_new_line() { } #[test] #[ignore] -fn test_comma() { +fn comma() { let mut builder = CsvRecordBuilder::new(); builder.add("ant"); @@ -51,7 +51,7 @@ fn test_comma() { #[test] #[ignore] -fn test_empty() { +fn empty() { let builder = CsvRecordBuilder::new(); let list = builder.build(); assert!(list.is_empty()); diff --git a/exercises/concept/health-statistics/tests/health-statistics.rs b/exercises/concept/health-statistics/tests/health-statistics.rs index 26ff2a79b..e933f19a4 100644 --- a/exercises/concept/health-statistics/tests/health-statistics.rs +++ b/exercises/concept/health-statistics/tests/health-statistics.rs @@ -5,28 +5,28 @@ const AGE: u32 = 89; const WEIGHT: f32 = 131.6; #[test] -fn test_name() { +fn name() { let user = User::new(NAME.into(), AGE, WEIGHT); assert_eq!(user.name(), NAME); } #[test] #[ignore] -fn test_age() { +fn age() { let user = User::new(NAME.into(), AGE, WEIGHT); assert_eq!(user.age(), AGE); } #[test] #[ignore] -fn test_weight() { +fn weight() { let user = User::new(NAME.into(), AGE, WEIGHT); assert!((user.weight() - WEIGHT).abs() < f32::EPSILON); } #[test] #[ignore] -fn test_set_age() { +fn set_age() { let new_age: u32 = 90; let mut user = User::new(NAME.into(), AGE, WEIGHT); user.set_age(new_age); @@ -35,7 +35,7 @@ fn test_set_age() { #[test] #[ignore] -fn test_set_weight() { +fn set_weight() { let new_weight: f32 = 129.4; let mut user = User::new(NAME.into(), AGE, WEIGHT); user.set_weight(new_weight); diff --git a/exercises/concept/magazine-cutout/tests/magazine-cutout.rs b/exercises/concept/magazine-cutout/tests/magazine-cutout.rs index 2062d1d92..0b73c7a02 100644 --- a/exercises/concept/magazine-cutout/tests/magazine-cutout.rs +++ b/exercises/concept/magazine-cutout/tests/magazine-cutout.rs @@ -1,7 +1,7 @@ use magazine_cutout::*; #[test] -fn test_magazine_has_fewer_words_available_than_needed() { +fn magazine_has_fewer_words_available_than_needed() { let magazine = "two times three is not four" .split_whitespace() .collect::>(); @@ -13,7 +13,7 @@ fn test_magazine_has_fewer_words_available_than_needed() { #[test] #[ignore] -fn test_fn_returns_true_for_good_input() { +fn fn_returns_true_for_good_input() { let magazine = "The metro orchestra unveiled its new grand piano today. Its donor paraphrased Nathn Hale: \"I only regret that I have but one to give \"".split_whitespace().collect::>(); let note = "give one grand today." .split_whitespace() @@ -23,7 +23,7 @@ fn test_fn_returns_true_for_good_input() { #[test] #[ignore] -fn test_fn_returns_false_for_bad_input() { +fn fn_returns_false_for_bad_input() { let magazine = "I've got a lovely bunch of coconuts." .split_whitespace() .collect::>(); @@ -35,7 +35,7 @@ fn test_fn_returns_false_for_bad_input() { #[test] #[ignore] -fn test_case_sensitivity() { +fn case_sensitivity() { let magazine = "i've got some lovely coconuts" .split_whitespace() .collect::>(); @@ -55,7 +55,7 @@ fn test_case_sensitivity() { #[test] #[ignore] -fn test_magazine_has_more_words_available_than_needed() { +fn magazine_has_more_words_available_than_needed() { let magazine = "Enough is enough when enough is enough" .split_whitespace() .collect::>(); @@ -65,7 +65,7 @@ fn test_magazine_has_more_words_available_than_needed() { #[test] #[ignore] -fn test_magazine_has_one_good_word_many_times_but_still_cant_construct() { +fn magazine_has_one_good_word_many_times_but_still_cant_construct() { let magazine = "A A A".split_whitespace().collect::>(); let note = "A nice day".split_whitespace().collect::>(); assert!(!can_construct_note(&magazine, ¬e)); diff --git a/exercises/concept/resistor-color/tests/resistor-color.rs b/exercises/concept/resistor-color/tests/resistor-color.rs index 1e6523b12..b0806797b 100644 --- a/exercises/concept/resistor-color/tests/resistor-color.rs +++ b/exercises/concept/resistor-color/tests/resistor-color.rs @@ -1,43 +1,43 @@ use resistor_color::{color_to_value, colors, value_to_color_string, ResistorColor}; #[test] -fn test_black() { +fn black() { assert_eq!(color_to_value(ResistorColor::Black), 0); } #[test] #[ignore] -fn test_orange() { +fn orange() { assert_eq!(color_to_value(ResistorColor::Orange), 3); } #[test] #[ignore] -fn test_white() { +fn white() { assert_eq!(color_to_value(ResistorColor::White), 9); } #[test] #[ignore] -fn test_2() { +fn two() { assert_eq!(value_to_color_string(2), String::from("Red")); } #[test] #[ignore] -fn test_6() { +fn six() { assert_eq!(value_to_color_string(6), String::from("Blue")); } #[test] #[ignore] -fn test_8() { +fn eight() { assert_eq!(value_to_color_string(8), String::from("Grey")); } #[test] #[ignore] -fn test_11_out_of_range() { +fn eleven_out_of_range() { assert_eq!( value_to_color_string(11), String::from("value out of range") @@ -46,7 +46,7 @@ fn test_11_out_of_range() { #[test] #[ignore] -fn test_all_colors() { +fn all_colors() { use ResistorColor::*; assert_eq!( colors(), diff --git a/exercises/concept/role-playing-game/tests/role-playing-game.rs b/exercises/concept/role-playing-game/tests/role-playing-game.rs index 499320746..ac7ad71dc 100644 --- a/exercises/concept/role-playing-game/tests/role-playing-game.rs +++ b/exercises/concept/role-playing-game/tests/role-playing-game.rs @@ -1,7 +1,7 @@ use role_playing_game::*; #[test] -fn test_reviving_dead_player() { +fn reviving_dead_player() { let dead_player = Player { health: 0, mana: Some(0), @@ -17,7 +17,7 @@ fn test_reviving_dead_player() { #[test] #[ignore] -fn test_reviving_dead_level9_player() { +fn reviving_dead_level9_player() { let dead_player = Player { health: 0, mana: None, @@ -33,7 +33,7 @@ fn test_reviving_dead_level9_player() { #[test] #[ignore] -fn test_reviving_dead_level10_player() { +fn reviving_dead_level10_player() { let dead_player = Player { health: 0, mana: Some(0), @@ -49,7 +49,7 @@ fn test_reviving_dead_level10_player() { #[test] #[ignore] -fn test_reviving_alive_player() { +fn reviving_alive_player() { let alive_player = Player { health: 1, mana: None, @@ -60,7 +60,7 @@ fn test_reviving_alive_player() { #[test] #[ignore] -fn test_cast_spell_with_enough_mana() { +fn cast_spell_with_enough_mana() { const HEALTH: u32 = 99; const MANA: u32 = 100; const LEVEL: u32 = 100; @@ -80,7 +80,7 @@ fn test_cast_spell_with_enough_mana() { #[test] #[ignore] -fn test_cast_spell_with_insufficient_mana() { +fn cast_spell_with_insufficient_mana() { let mut no_mana_wizard = Player { health: 56, mana: Some(2), @@ -99,7 +99,7 @@ fn test_cast_spell_with_insufficient_mana() { #[test] #[ignore] -fn test_cast_spell_with_no_mana_pool() { +fn cast_spell_with_no_mana_pool() { const MANA_COST: u32 = 10; let mut underleveled_player = Player { @@ -120,7 +120,7 @@ fn test_cast_spell_with_no_mana_pool() { #[test] #[ignore] -fn test_cast_large_spell_with_no_mana_pool() { +fn cast_large_spell_with_no_mana_pool() { const MANA_COST: u32 = 30; let mut underleveled_player = Player { diff --git a/exercises/concept/rpn-calculator/tests/rpn-calculator.rs b/exercises/concept/rpn-calculator/tests/rpn-calculator.rs index eba9c5f96..e33d058be 100644 --- a/exercises/concept/rpn-calculator/tests/rpn-calculator.rs +++ b/exercises/concept/rpn-calculator/tests/rpn-calculator.rs @@ -13,77 +13,77 @@ fn calculator_input(s: &str) -> Vec { } #[test] -fn test_empty_input_returns_none() { +fn empty_input_returns_none() { let input = calculator_input(""); assert_eq!(evaluate(&input), None); } #[test] #[ignore] -fn test_simple_value() { +fn simple_value() { let input = calculator_input("10"); assert_eq!(evaluate(&input), Some(10)); } #[test] #[ignore] -fn test_simple_addition() { +fn simple_addition() { let input = calculator_input("2 2 +"); assert_eq!(evaluate(&input), Some(4)); } #[test] #[ignore] -fn test_simple_subtraction() { +fn simple_subtraction() { let input = calculator_input("7 11 -"); assert_eq!(evaluate(&input), Some(-4)); } #[test] #[ignore] -fn test_simple_multiplication() { +fn simple_multiplication() { let input = calculator_input("6 9 *"); assert_eq!(evaluate(&input), Some(54)); } #[test] #[ignore] -fn test_simple_division() { +fn simple_division() { let input = calculator_input("57 19 /"); assert_eq!(evaluate(&input), Some(3)); } #[test] #[ignore] -fn test_complex_operation() { +fn complex_operation() { let input = calculator_input("4 8 + 7 5 - /"); assert_eq!(evaluate(&input), Some(6)); } #[test] #[ignore] -fn test_too_few_operands_returns_none() { +fn too_few_operands_returns_none() { let input = calculator_input("2 +"); assert_eq!(evaluate(&input), None); } #[test] #[ignore] -fn test_too_many_operands_returns_none() { +fn too_many_operands_returns_none() { let input = calculator_input("2 2"); assert_eq!(evaluate(&input), None); } #[test] #[ignore] -fn test_zero_operands_returns_none() { +fn zero_operands_returns_none() { let input = calculator_input("+"); assert_eq!(evaluate(&input), None); } #[test] #[ignore] -fn test_intermediate_error_returns_none() { +fn intermediate_error_returns_none() { let input = calculator_input("+ 2 2 *"); assert_eq!(evaluate(&input), None); } diff --git a/exercises/concept/short-fibonacci/tests/short-fibonacci.rs b/exercises/concept/short-fibonacci/tests/short-fibonacci.rs index db6b2eb85..a0fb1a84d 100644 --- a/exercises/concept/short-fibonacci/tests/short-fibonacci.rs +++ b/exercises/concept/short-fibonacci/tests/short-fibonacci.rs @@ -1,21 +1,23 @@ use short_fibonacci::*; #[test] -fn test_empty() { +fn empty() { assert_eq!(create_empty(), Vec::new()); } + #[test] #[ignore] -fn test_buffer() { +fn buffer() { for n in 0..10 { let zeroized = create_buffer(n); assert_eq!(zeroized.len(), n); assert!(zeroized.iter().all(|&v| v == 0)); } } + #[test] #[ignore] -fn test_fibonacci() { +fn first_five_elements() { let fibb = fibonacci(); assert_eq!(fibb.len(), 5); assert_eq!(fibb[0], 1); diff --git a/exercises/practice/alphametics/tests/alphametics.rs b/exercises/practice/alphametics/tests/alphametics.rs index 8f9859185..2e07d87e3 100644 --- a/exercises/practice/alphametics/tests/alphametics.rs +++ b/exercises/practice/alphametics/tests/alphametics.rs @@ -7,27 +7,27 @@ fn assert_alphametic_solution_eq(puzzle: &str, solution: &[(char, u8)]) { } #[test] -fn test_with_three_letters() { +fn with_three_letters() { assert_alphametic_solution_eq("I + BB == ILL", &[('I', 1), ('B', 9), ('L', 0)]); } #[test] #[ignore] -fn test_must_have_unique_value_for_each_letter() { +fn must_have_unique_value_for_each_letter() { let answer = alphametics::solve("A == B"); assert_eq!(answer, None); } #[test] #[ignore] -fn test_leading_zero_solution_is_invalid() { +fn leading_zero_solution_is_invalid() { let answer = alphametics::solve("ACA + DD == BD"); assert_eq!(answer, None); } #[test] #[ignore] -fn test_sum_must_be_wide_enough() { +fn sum_must_be_wide_enough() { let answer = alphametics::solve("ABC + DEF == GH"); assert_eq!(answer, None); } @@ -43,13 +43,13 @@ fn puzzle_with_two_digits_final_carry() { #[test] #[ignore] -fn test_puzzle_with_four_letters() { +fn puzzle_with_four_letters() { assert_alphametic_solution_eq("AS + A == MOM", &[('A', 9), ('S', 2), ('M', 1), ('O', 0)]); } #[test] #[ignore] -fn test_puzzle_with_six_letters() { +fn puzzle_with_six_letters() { assert_alphametic_solution_eq( "NO + NO + TOO == LATE", &[('N', 7), ('O', 4), ('T', 9), ('L', 1), ('A', 0), ('E', 2)], @@ -58,7 +58,7 @@ fn test_puzzle_with_six_letters() { #[test] #[ignore] -fn test_puzzle_with_seven_letters() { +fn puzzle_with_seven_letters() { assert_alphametic_solution_eq( "HE + SEES + THE == LIGHT", &[ @@ -75,7 +75,7 @@ fn test_puzzle_with_seven_letters() { #[test] #[ignore] -fn test_puzzle_with_eight_letters() { +fn puzzle_with_eight_letters() { assert_alphametic_solution_eq( "SEND + MORE == MONEY", &[ @@ -93,7 +93,7 @@ fn test_puzzle_with_eight_letters() { #[test] #[ignore] -fn test_puzzle_with_ten_letters() { +fn puzzle_with_ten_letters() { assert_alphametic_solution_eq( "AND + A + STRONG + OFFENSE + AS + A + GOOD == DEFENSE", &[ @@ -113,7 +113,7 @@ fn test_puzzle_with_ten_letters() { #[test] #[ignore] -fn test_puzzle_with_ten_letters_and_199_addends() { +fn puzzle_with_ten_letters_and_199_addends() { assert_alphametic_solution_eq( "THIS + A + FIRE + THEREFORE + FOR + ALL + HISTORIES + I + TELL + A + TALE + THAT + FALSIFIES + ITS + TITLE + TIS + A + LIE + THE + TALE + OF + THE + LAST + FIRE + HORSES + LATE + AFTER + THE + FIRST + FATHERS + FORESEE + THE + HORRORS + THE + LAST + FREE + TROLL + TERRIFIES + THE + HORSES + OF + FIRE + THE + TROLL + RESTS + AT + THE + HOLE + OF + LOSSES + IT + IS + THERE + THAT + SHE + STORES + ROLES + OF + LEATHERS + AFTER + SHE + SATISFIES + HER + HATE + OFF + THOSE + FEARS + A + TASTE + RISES + AS + SHE + HEARS + THE + LEAST + FAR + HORSE + THOSE + FAST + HORSES + THAT + FIRST + HEAR + THE + TROLL + FLEE + OFF + TO + THE + FOREST + THE + HORSES + THAT + ALERTS + RAISE + THE + STARES + OF + THE + OTHERS + AS + THE + TROLL + ASSAILS + AT + THE + TOTAL + SHIFT + HER + TEETH + TEAR + HOOF + OFF + TORSO + AS + THE + LAST + HORSE + FORFEITS + ITS + LIFE + THE + FIRST + FATHERS + HEAR + OF + THE + HORRORS + THEIR + FEARS + THAT + THE + FIRES + FOR + THEIR + FEASTS + ARREST + AS + THE + FIRST + FATHERS + RESETTLE + THE + LAST + OF + THE + FIRE + HORSES + THE + LAST + TROLL + HARASSES + THE + FOREST + HEART + FREE + AT + LAST + OF + THE + LAST + TROLL + ALL + OFFER + THEIR + FIRE + HEAT + TO + THE + ASSISTERS + FAR + OFF + THE + TROLL + FASTS + ITS + LIFE + SHORTER + AS + STARS + RISE + THE + HORSES + REST + SAFE + AFTER + ALL + SHARE + HOT + FISH + AS + THEIR + AFFILIATES + TAILOR + A + ROOFS + FOR + THEIR + SAFE == FORTRESSES", &[ diff --git a/exercises/practice/anagram/tests/anagram.rs b/exercises/practice/anagram/tests/anagram.rs index 6fbb00933..4ac7a283c 100644 --- a/exercises/practice/anagram/tests/anagram.rs +++ b/exercises/practice/anagram/tests/anagram.rs @@ -9,7 +9,7 @@ fn process_anagram_case(word: &str, inputs: &[&str], expected: &[&str]) { } #[test] -fn test_no_matches() { +fn no_matches() { let word = "diaper"; let inputs = ["hello", "world", "zombies", "pants"]; @@ -21,7 +21,7 @@ fn test_no_matches() { #[test] #[ignore] -fn test_detect_simple_anagram() { +fn detect_simple_anagram() { let word = "ant"; let inputs = ["tan", "stand", "at"]; @@ -33,7 +33,7 @@ fn test_detect_simple_anagram() { #[test] #[ignore] -fn test_does_not_confuse_different_duplicates() { +fn does_not_confuse_different_duplicates() { let word = "galea"; let inputs = ["eagle"]; @@ -45,7 +45,7 @@ fn test_does_not_confuse_different_duplicates() { #[test] #[ignore] -fn test_eliminate_anagram_subsets() { +fn eliminate_anagram_subsets() { let word = "good"; let inputs = ["dog", "goody"]; @@ -57,7 +57,7 @@ fn test_eliminate_anagram_subsets() { #[test] #[ignore] -fn test_detect_anagram() { +fn detect_anagram() { let word = "listen"; let inputs = ["enlists", "google", "inlets", "banana"]; @@ -69,7 +69,7 @@ fn test_detect_anagram() { #[test] #[ignore] -fn test_multiple_anagrams() { +fn multiple_anagrams() { let word = "allergy"; let inputs = [ @@ -88,7 +88,7 @@ fn test_multiple_anagrams() { #[test] #[ignore] -fn test_case_insensitive_anagrams() { +fn case_insensitive_anagrams() { let word = "Orchestra"; let inputs = ["cashregister", "Carthorse", "radishes"]; @@ -100,7 +100,7 @@ fn test_case_insensitive_anagrams() { #[test] #[ignore] -fn test_unicode_anagrams() { +fn unicode_anagrams() { let word = "ΑΒΓ"; // These words don't make sense, they're just greek letters cobbled together. @@ -113,7 +113,7 @@ fn test_unicode_anagrams() { #[test] #[ignore] -fn test_misleading_unicode_anagrams() { +fn misleading_unicode_anagrams() { // Despite what a human might think these words contain different letters, the input uses Greek // A and B while the list of potential anagrams uses Latin A and B. let word = "ΑΒΓ"; @@ -127,7 +127,7 @@ fn test_misleading_unicode_anagrams() { #[test] #[ignore] -fn test_does_not_detect_a_word_as_its_own_anagram() { +fn does_not_detect_a_word_as_its_own_anagram() { let word = "banana"; let inputs = ["banana"]; @@ -139,7 +139,7 @@ fn test_does_not_detect_a_word_as_its_own_anagram() { #[test] #[ignore] -fn test_does_not_detect_a_differently_cased_word_as_its_own_anagram() { +fn does_not_detect_a_differently_cased_word_as_its_own_anagram() { let word = "banana"; let inputs = ["bAnana"]; @@ -151,7 +151,7 @@ fn test_does_not_detect_a_differently_cased_word_as_its_own_anagram() { #[test] #[ignore] -fn test_does_not_detect_a_differently_cased_unicode_word_as_its_own_anagram() { +fn does_not_detect_a_differently_cased_unicode_word_as_its_own_anagram() { let word = "ΑΒΓ"; let inputs = ["ΑΒγ"]; @@ -163,7 +163,7 @@ fn test_does_not_detect_a_differently_cased_unicode_word_as_its_own_anagram() { #[test] #[ignore] -fn test_same_bytes_different_chars() { +fn same_bytes_different_chars() { let word = "a⬂"; // 61 E2 AC 82 let inputs = ["€a"]; // E2 82 AC 61 @@ -175,7 +175,7 @@ fn test_same_bytes_different_chars() { #[test] #[ignore] -fn test_different_words_but_same_ascii_sum() { +fn different_words_but_same_ascii_sum() { let word = "bc"; let inputs = ["ad"]; diff --git a/exercises/practice/armstrong-numbers/tests/armstrong-numbers.rs b/exercises/practice/armstrong-numbers/tests/armstrong-numbers.rs index 8e5713b05..055ebe758 100644 --- a/exercises/practice/armstrong-numbers/tests/armstrong-numbers.rs +++ b/exercises/practice/armstrong-numbers/tests/armstrong-numbers.rs @@ -1,73 +1,73 @@ use armstrong_numbers::*; #[test] -fn test_zero_is_an_armstrong_number() { +fn zero_is_an_armstrong_number() { assert!(is_armstrong_number(0)) } #[test] #[ignore] -fn test_single_digit_numbers_are_armstrong_numbers() { +fn single_digit_numbers_are_armstrong_numbers() { assert!(is_armstrong_number(5)) } #[test] #[ignore] -fn test_there_are_no_2_digit_armstrong_numbers() { +fn there_are_no_2_digit_armstrong_numbers() { assert!(!is_armstrong_number(10)) } #[test] #[ignore] -fn test_three_digit_armstrong_number() { +fn three_digit_armstrong_number() { assert!(is_armstrong_number(153)) } #[test] #[ignore] -fn test_three_digit_non_armstrong_number() { +fn three_digit_non_armstrong_number() { assert!(!is_armstrong_number(100)) } #[test] #[ignore] -fn test_four_digit_armstrong_number() { +fn four_digit_armstrong_number() { assert!(is_armstrong_number(9474)) } #[test] #[ignore] -fn test_four_digit_non_armstrong_number() { +fn four_digit_non_armstrong_number() { assert!(!is_armstrong_number(9475)) } #[test] #[ignore] -fn test_seven_digit_armstrong_number() { +fn seven_digit_armstrong_number() { assert!(is_armstrong_number(9_926_315)) } #[test] #[ignore] -fn test_seven_digit_non_armstrong_number() { +fn seven_digit_non_armstrong_number() { assert!(!is_armstrong_number(9_926_316)) } #[test] #[ignore] -fn test_nine_digit_armstrong_number() { +fn nine_digit_armstrong_number() { assert!(is_armstrong_number(912_985_153)); } #[test] #[ignore] -fn test_nine_digit_non_armstrong_number() { +fn nine_digit_non_armstrong_number() { assert!(!is_armstrong_number(999_999_999)); } #[test] #[ignore] -fn test_ten_digit_non_armstrong_number() { +fn ten_digit_non_armstrong_number() { assert!(!is_armstrong_number(3_999_999_999)); } @@ -76,6 +76,6 @@ fn test_ten_digit_non_armstrong_number() { // incorrectly using wrapping arithmetic. #[test] #[ignore] -fn test_properly_handles_overflow() { +fn properly_handles_overflow() { assert!(!is_armstrong_number(4_106_098_957)); } diff --git a/exercises/practice/atbash-cipher/tests/atbash-cipher.rs b/exercises/practice/atbash-cipher/tests/atbash-cipher.rs index 689426f4f..214af9fe3 100644 --- a/exercises/practice/atbash-cipher/tests/atbash-cipher.rs +++ b/exercises/practice/atbash-cipher/tests/atbash-cipher.rs @@ -1,37 +1,37 @@ use atbash_cipher as cipher; #[test] -fn test_encode_yes() { +fn encode_yes() { assert_eq!(cipher::encode("yes"), "bvh"); } #[test] #[ignore] -fn test_encode_no() { +fn encode_no() { assert_eq!(cipher::encode("no"), "ml"); } #[test] #[ignore] -fn test_encode_omg() { +fn encode_omg() { assert_eq!(cipher::encode("OMG"), "lnt"); } #[test] #[ignore] -fn test_encode_spaces() { +fn encode_spaces() { assert_eq!(cipher::encode("O M G"), "lnt"); } #[test] #[ignore] -fn test_encode_mindblowingly() { +fn encode_mindblowingly() { assert_eq!(cipher::encode("mindblowingly"), "nrmwy oldrm tob"); } #[test] #[ignore] -fn test_encode_numbers() { +fn encode_numbers() { assert_eq!( cipher::encode("Testing,1 2 3, testing."), "gvhgr mt123 gvhgr mt" @@ -40,13 +40,13 @@ fn test_encode_numbers() { #[test] #[ignore] -fn test_encode_deep_thought() { +fn encode_deep_thought() { assert_eq!(cipher::encode("Truth is fiction."), "gifgs rhurx grlm"); } #[test] #[ignore] -fn test_encode_all_the_letters() { +fn encode_all_the_letters() { assert_eq!( cipher::encode("The quick brown fox jumps over the lazy dog."), "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" @@ -55,13 +55,13 @@ fn test_encode_all_the_letters() { #[test] #[ignore] -fn test_decode_exercism() { +fn decode_exercism() { assert_eq!(cipher::decode("vcvix rhn"), "exercism"); } #[test] #[ignore] -fn test_decode_a_sentence() { +fn decode_a_sentence() { assert_eq!( cipher::decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v"), "anobstacleisoftenasteppingstone" @@ -70,13 +70,13 @@ fn test_decode_a_sentence() { #[test] #[ignore] -fn test_decode_numbers() { +fn decode_numbers() { assert_eq!(cipher::decode("gvhgr mt123 gvhgr mt"), "testing123testing"); } #[test] #[ignore] -fn test_decode_all_the_letters() { +fn decode_all_the_letters() { assert_eq!( cipher::decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"), "thequickbrownfoxjumpsoverthelazydog" @@ -85,13 +85,13 @@ fn test_decode_all_the_letters() { #[test] #[ignore] -fn test_decode_with_too_many_spaces() { +fn decode_with_too_many_spaces() { assert_eq!(cipher::decode("vc vix r hn"), "exercism"); } #[test] #[ignore] -fn test_decode_with_no_spaces() { +fn decode_with_no_spaces() { assert_eq!( cipher::decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv"), "anobstacleisoftenasteppingstone", diff --git a/exercises/practice/beer-song/tests/beer-song.rs b/exercises/practice/beer-song/tests/beer-song.rs index d5daaf363..64fd99df7 100644 --- a/exercises/practice/beer-song/tests/beer-song.rs +++ b/exercises/practice/beer-song/tests/beer-song.rs @@ -1,36 +1,36 @@ use beer_song as beer; #[test] -fn test_verse_0() { +fn verse_0() { assert_eq!(beer::verse(0), "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"); } #[test] #[ignore] -fn test_verse_1() { +fn verse_1() { assert_eq!(beer::verse(1), "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n"); } #[test] #[ignore] -fn test_verse_2() { +fn verse_2() { assert_eq!(beer::verse(2), "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n"); } #[test] #[ignore] -fn test_verse_8() { +fn verse_8() { assert_eq!(beer::verse(8), "8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n"); } #[test] #[ignore] -fn test_song_8_6() { +fn song_8_6() { assert_eq!(beer::sing(8, 6), "8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n"); } #[test] #[ignore] -fn test_song_3_0() { +fn song_3_0() { assert_eq!(beer::sing(3, 0), "3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"); } diff --git a/exercises/practice/bob/.articles/performance/code/main.rs b/exercises/practice/bob/.articles/performance/code/main.rs index 1eb8d37bd..ffff8656c 100644 --- a/exercises/practice/bob/.articles/performance/code/main.rs +++ b/exercises/practice/bob/.articles/performance/code/main.rs @@ -73,18 +73,18 @@ pub fn reply_array(msg: &str) -> &str { #[bench] /// multiple line question for match -fn test_multiple_line_question_match(b: &mut Bencher) { +fn multiple_line_question_match(b: &mut Bencher) { b.iter(|| reply_match("\rDoes this cryogenic chamber make me look fat?\rNo.")); } #[bench] /// multiple line question for if statements -fn test_multiple_line_question_if(b: &mut Bencher) { +fn multiple_line_question_if(b: &mut Bencher) { b.iter(|| reply_if_chain("\rDoes this cryogenic chamber make me look fat?\rNo.")); } #[bench] /// multiple line question for answer array -fn test_multiple_line_question_array(b: &mut Bencher) { +fn multiple_line_question_array(b: &mut Bencher) { b.iter(|| reply_array("\rDoes this cryogenic chamber make me look fat?\rNo.")); } diff --git a/exercises/practice/bob/.articles/performance/content.md b/exercises/practice/bob/.articles/performance/content.md index ec3bbc225..d24be3298 100644 --- a/exercises/practice/bob/.articles/performance/content.md +++ b/exercises/practice/bob/.articles/performance/content.md @@ -14,9 +14,9 @@ For our performance investigation, we'll also include a third approach that [use To benchmark the approaches, we wrote a [small benchmark application][benchmark-application]. ``` -test test_multiple_line_question_match ... bench: 96 ns/iter (+/- 17) -test test_multiple_line_question_if ... bench: 97 ns/iter (+/- 12) -test test_multiple_line_question_array ... bench: 100 ns/iter (+/- 2) +test multiple_line_question_match ... bench: 96 ns/iter (+/- 17) +test multiple_line_question_if ... bench: 97 ns/iter (+/- 12) +test multiple_line_question_array ... bench: 100 ns/iter (+/- 2) ``` All three approaches are close in performance, but the `if` statements and `match` approaches may be considered to be more idiomatic. diff --git a/exercises/practice/bob/.articles/performance/snippet.md b/exercises/practice/bob/.articles/performance/snippet.md index afaf94aa5..f6e718a27 100644 --- a/exercises/practice/bob/.articles/performance/snippet.md +++ b/exercises/practice/bob/.articles/performance/snippet.md @@ -1,5 +1,5 @@ ``` -test test_multiple_line_question_match ... bench: 96 ns/iter (+/- 17) -test test_multiple_line_question_if ... bench: 97 ns/iter (+/- 12) -test test_multiple_line_question_array ... bench: 100 ns/iter (+/- 2) +test multiple_line_question_match ... bench: 96 ns/iter (+/- 17) +test multiple_line_question_if ... bench: 97 ns/iter (+/- 12) +test multiple_line_question_array ... bench: 100 ns/iter (+/- 2) ``` diff --git a/exercises/practice/bob/tests/bob.rs b/exercises/practice/bob/tests/bob.rs index 330c7ff2b..fdee5588f 100644 --- a/exercises/practice/bob/tests/bob.rs +++ b/exercises/practice/bob/tests/bob.rs @@ -4,35 +4,35 @@ fn process_response_case(phrase: &str, expected_response: &str) { #[test] /// stating something -fn test_stating_something() { +fn stating_something() { process_response_case("Tom-ay-to, tom-aaaah-to.", "Whatever."); } #[test] #[ignore] /// ending with whitespace -fn test_ending_with_whitespace() { +fn ending_with_whitespace() { process_response_case("Okay if like my spacebar quite a bit? ", "Sure."); } #[test] #[ignore] /// shouting numbers -fn test_shouting_numbers() { +fn shouting_numbers() { process_response_case("1, 2, 3 GO!", "Whoa, chill out!"); } #[test] #[ignore] /// other whitespace -fn test_other_whitespace() { +fn other_whitespace() { process_response_case("\r\r ", "Fine. Be that way!"); } #[test] #[ignore] /// shouting with special characters -fn test_shouting_with_special_characters() { +fn shouting_with_special_characters() { process_response_case( "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!", "Whoa, chill out!", @@ -42,56 +42,56 @@ fn test_shouting_with_special_characters() { #[test] #[ignore] /// talking forcefully -fn test_talking_forcefully() { +fn talking_forcefully() { process_response_case("Hi there!", "Whatever."); } #[test] #[ignore] /// prattling on -fn test_prattling_on() { +fn prattling_on() { process_response_case("Wait! Hang on. Are you going to be OK?", "Sure."); } #[test] #[ignore] /// forceful question -fn test_forceful_question() { +fn forceful_question() { process_response_case("WHAT'S GOING ON?", "Calm down, I know what I'm doing!"); } #[test] #[ignore] /// shouting with no exclamation mark -fn test_shouting_with_no_exclamation_mark() { +fn shouting_with_no_exclamation_mark() { process_response_case("I HATE THE DENTIST", "Whoa, chill out!"); } #[test] #[ignore] /// asking gibberish -fn test_asking_gibberish() { +fn asking_gibberish() { process_response_case("fffbbcbeab?", "Sure."); } #[test] #[ignore] /// question with no letters -fn test_question_with_no_letters() { +fn question_with_no_letters() { process_response_case("4?", "Sure."); } #[test] #[ignore] /// no letters -fn test_no_letters() { +fn no_letters() { process_response_case("1, 2, 3", "Whatever."); } #[test] #[ignore] /// statement containing question mark -fn test_statement_containing_question_mark() { +fn statement_containing_question_mark() { process_response_case("Ending with ? means a question.", "Whatever."); } @@ -99,7 +99,7 @@ fn test_statement_containing_question_mark() { #[test] #[ignore] /// multiple line question -fn test_multiple_line_question() { +fn multiple_line_question() { process_response_case( "\rDoes this cryogenic chamber make me look fat?\rNo.", "Whatever.", @@ -109,7 +109,7 @@ fn test_multiple_line_question() { #[test] #[ignore] /// non-question ending with whitespace -fn test_nonquestion_ending_with_whitespace() { +fn nonquestion_ending_with_whitespace() { process_response_case( "This is a statement ending with whitespace ", "Whatever.", @@ -119,56 +119,56 @@ fn test_nonquestion_ending_with_whitespace() { #[test] #[ignore] /// shouting -fn test_shouting() { +fn shouting() { process_response_case("WATCH OUT!", "Whoa, chill out!"); } #[test] #[ignore] /// non-letters with question -fn test_nonletters_with_question() { +fn nonletters_with_question() { process_response_case(":) ?", "Sure."); } #[test] #[ignore] /// shouting gibberish -fn test_shouting_gibberish() { +fn shouting_gibberish() { process_response_case("FCECDFCAAB", "Whoa, chill out!"); } #[test] #[ignore] /// asking a question -fn test_asking_a_question() { +fn asking_a_question() { process_response_case("Does this cryogenic chamber make me look fat?", "Sure."); } #[test] #[ignore] /// asking a numeric question -fn test_asking_a_numeric_question() { +fn asking_a_numeric_question() { process_response_case("You are, what, like 15?", "Sure."); } #[test] #[ignore] /// silence -fn test_silence() { +fn silence() { process_response_case("", "Fine. Be that way!"); } #[test] #[ignore] /// starting with whitespace -fn test_starting_with_whitespace() { +fn starting_with_whitespace() { process_response_case(" hmmmmmmm...", "Whatever."); } #[test] #[ignore] /// using acronyms in regular speech -fn test_using_acronyms_in_regular_speech() { +fn using_acronyms_in_regular_speech() { process_response_case( "It's OK if you don't want to go work for NASA.", "Whatever.", @@ -178,13 +178,13 @@ fn test_using_acronyms_in_regular_speech() { #[test] #[ignore] /// alternate silence -fn test_alternate_silence() { +fn alternate_silence() { process_response_case(" ", "Fine. Be that way!"); } #[test] #[ignore] /// prolonged silence -fn test_prolonged_silence() { +fn prolonged_silence() { process_response_case(" ", "Fine. Be that way!"); } diff --git a/exercises/practice/book-store/tests/book-store.rs b/exercises/practice/book-store/tests/book-store.rs index e959453b5..5dbee56a1 100644 --- a/exercises/practice/book-store/tests/book-store.rs +++ b/exercises/practice/book-store/tests/book-store.rs @@ -24,56 +24,56 @@ fn process_total_case(input: (Vec, Vec>), expected: u32) { #[test] /// Only a single book -fn test_only_a_single_book() { +fn only_a_single_book() { process_total_case((vec![1], vec![vec![1]]), 800); } #[test] #[ignore] /// Two of the same book -fn test_two_of_the_same_book() { +fn two_of_the_same_book() { process_total_case((vec![2, 2], vec![vec![2], vec![2]]), 1_600); } #[test] #[ignore] /// Empty basket -fn test_empty_basket() { +fn empty_basket() { process_total_case((vec![], vec![]), 0); } #[test] #[ignore] /// Two different books -fn test_two_different_books() { +fn two_different_books() { process_total_case((vec![1, 2], vec![vec![1, 2]]), 1_520); } #[test] #[ignore] /// Three different books -fn test_three_different_books() { +fn three_different_books() { process_total_case((vec![1, 2, 3], vec![vec![1, 2, 3]]), 2_160); } #[test] #[ignore] /// Four different books -fn test_four_different_books() { +fn four_different_books() { process_total_case((vec![1, 2, 3, 4], vec![vec![1, 2, 3, 4]]), 2_560); } #[test] #[ignore] /// Five different books -fn test_five_different_books() { +fn five_different_books() { process_total_case((vec![1, 2, 3, 4, 5], vec![vec![1, 2, 3, 4, 5]]), 3_000); } #[test] #[ignore] /// Two groups of four is cheaper than group of five plus group of three -fn test_two_groups_of_four_is_cheaper_than_group_of_five_plus_group_of_three() { +fn two_groups_of_four_is_cheaper_than_group_of_five_plus_group_of_three() { process_total_case( ( vec![1, 1, 2, 2, 3, 3, 4, 5], @@ -86,7 +86,7 @@ fn test_two_groups_of_four_is_cheaper_than_group_of_five_plus_group_of_three() { #[test] #[ignore] /// Group of four plus group of two is cheaper than two groups of three -fn test_group_of_four_plus_group_of_two_is_cheaper_than_two_groups_of_three() { +fn group_of_four_plus_group_of_two_is_cheaper_than_two_groups_of_three() { process_total_case( (vec![1, 1, 2, 2, 3, 4], vec![vec![1, 2, 3, 4], vec![1, 2]]), 4_080, @@ -96,7 +96,7 @@ fn test_group_of_four_plus_group_of_two_is_cheaper_than_two_groups_of_three() { #[test] #[ignore] /// Two each of first 4 books and 1 copy each of rest -fn test_two_each_of_first_4_books_and_1_copy_each_of_rest() { +fn two_each_of_first_4_books_and_1_copy_each_of_rest() { process_total_case( ( vec![1, 1, 2, 2, 3, 3, 4, 4, 5], @@ -109,7 +109,7 @@ fn test_two_each_of_first_4_books_and_1_copy_each_of_rest() { #[test] #[ignore] /// Two copies of each book -fn test_two_copies_of_each_book() { +fn two_copies_of_each_book() { process_total_case( ( vec![1, 1, 2, 2, 3, 3, 4, 4, 5, 5], @@ -122,7 +122,7 @@ fn test_two_copies_of_each_book() { #[test] #[ignore] /// Three copies of first book and 2 each of remaining -fn test_three_copies_of_first_book_and_2_each_of_remaining() { +fn three_copies_of_first_book_and_2_each_of_remaining() { process_total_case( ( vec![1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1], @@ -135,7 +135,7 @@ fn test_three_copies_of_first_book_and_2_each_of_remaining() { #[test] #[ignore] /// Three each of first 2 books and 2 each of remaining books -fn test_three_each_of_first_2_books_and_2_each_of_remaining_books() { +fn three_each_of_first_2_books_and_2_each_of_remaining_books() { process_total_case( ( vec![1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2], @@ -148,7 +148,7 @@ fn test_three_each_of_first_2_books_and_2_each_of_remaining_books() { #[test] #[ignore] /// Four groups of four are cheaper than two groups each of five and three -fn test_four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three() { +fn four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three() { process_total_case( ( vec![1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5], diff --git a/exercises/practice/clock/tests/clock.rs b/exercises/practice/clock/tests/clock.rs index 6d1ffdf54..416a6f985 100644 --- a/exercises/practice/clock/tests/clock.rs +++ b/exercises/practice/clock/tests/clock.rs @@ -5,133 +5,133 @@ use clock::Clock; // #[test] -fn test_on_the_hour() { +fn on_the_hour() { assert_eq!(Clock::new(8, 0).to_string(), "08:00"); } #[test] #[ignore] -fn test_past_the_hour() { +fn past_the_hour() { assert_eq!(Clock::new(11, 9).to_string(), "11:09"); } #[test] #[ignore] -fn test_midnight_is_zero_hours() { +fn midnight_is_zero_hours() { assert_eq!(Clock::new(24, 0).to_string(), "00:00"); } #[test] #[ignore] -fn test_hour_rolls_over() { +fn hour_rolls_over() { assert_eq!(Clock::new(25, 0).to_string(), "01:00"); } #[test] #[ignore] -fn test_hour_rolls_over_continuously() { +fn hour_rolls_over_continuously() { assert_eq!(Clock::new(100, 0).to_string(), "04:00"); } #[test] #[ignore] -fn test_sixty_minutes_is_next_hour() { +fn sixty_minutes_is_next_hour() { assert_eq!(Clock::new(1, 60).to_string(), "02:00"); } #[test] #[ignore] -fn test_minutes_roll_over() { +fn minutes_roll_over() { assert_eq!(Clock::new(0, 160).to_string(), "02:40"); } #[test] #[ignore] -fn test_minutes_roll_over_continuously() { +fn minutes_roll_over_continuously() { assert_eq!(Clock::new(0, 1723).to_string(), "04:43"); } #[test] #[ignore] -fn test_hours_and_minutes_roll_over() { +fn hours_and_minutes_roll_over() { assert_eq!(Clock::new(25, 160).to_string(), "03:40"); } #[test] #[ignore] -fn test_hours_and_minutes_roll_over_continuously() { +fn hours_and_minutes_roll_over_continuously() { assert_eq!(Clock::new(201, 3001).to_string(), "11:01"); } #[test] #[ignore] -fn test_hours_and_minutes_roll_over_to_exactly_midnight() { +fn hours_and_minutes_roll_over_to_exactly_midnight() { assert_eq!(Clock::new(72, 8640).to_string(), "00:00"); } #[test] #[ignore] -fn test_negative_hour() { +fn negative_hour() { assert_eq!(Clock::new(-1, 15).to_string(), "23:15"); } #[test] #[ignore] -fn test_negative_hour_roll_over() { +fn negative_hour_roll_over() { assert_eq!(Clock::new(-25, 00).to_string(), "23:00"); } #[test] #[ignore] -fn test_negative_hour_roll_over_continuously() { +fn negative_hour_roll_over_continuously() { assert_eq!(Clock::new(-91, 00).to_string(), "05:00"); } #[test] #[ignore] -fn test_negative_minutes() { +fn negative_minutes() { assert_eq!(Clock::new(1, -40).to_string(), "00:20"); } #[test] #[ignore] -fn test_negative_minutes_roll_over() { +fn negative_minutes_roll_over() { assert_eq!(Clock::new(1, -160).to_string(), "22:20"); } #[test] #[ignore] -fn test_negative_minutes_roll_over_continuously() { +fn negative_minutes_roll_over_continuously() { assert_eq!(Clock::new(1, -4820).to_string(), "16:40"); } #[test] #[ignore] -fn test_negative_sixty_minutes_is_prev_hour() { +fn negative_sixty_minutes_is_prev_hour() { assert_eq!(Clock::new(2, -60).to_string(), "01:00"); } #[test] #[ignore] -fn test_negative_one_twenty_minutes_is_two_prev_hours() { +fn negative_one_twenty_minutes_is_two_prev_hours() { assert_eq!(Clock::new(1, -120).to_string(), "23:00"); } #[test] #[ignore] -fn test_negative_hour_and_minutes_both_roll_over() { +fn negative_hour_and_minutes_both_roll_over() { assert_eq!(Clock::new(-25, -160).to_string(), "20:20"); } #[test] #[ignore] -fn test_negative_hour_and_minutes_both_roll_over_continuously() { +fn negative_hour_and_minutes_both_roll_over_continuously() { assert_eq!(Clock::new(-121, -5810).to_string(), "22:10"); } #[test] #[ignore] -fn test_zero_hour_and_negative_minutes() { +fn zero_hour_and_negative_minutes() { assert_eq!(Clock::new(0, -22).to_string(), "23:38"); } @@ -141,112 +141,112 @@ fn test_zero_hour_and_negative_minutes() { #[test] #[ignore] -fn test_add_minutes() { +fn add_minutes() { let clock = Clock::new(10, 0).add_minutes(3); assert_eq!(clock.to_string(), "10:03"); } #[test] #[ignore] -fn test_add_no_minutes() { +fn add_no_minutes() { let clock = Clock::new(6, 41).add_minutes(0); assert_eq!(clock.to_string(), "06:41"); } #[test] #[ignore] -fn test_add_to_next_hour() { +fn add_to_next_hour() { let clock = Clock::new(0, 45).add_minutes(40); assert_eq!(clock.to_string(), "01:25"); } #[test] #[ignore] -fn test_add_more_than_one_hour() { +fn add_more_than_one_hour() { let clock = Clock::new(10, 0).add_minutes(61); assert_eq!(clock.to_string(), "11:01"); } #[test] #[ignore] -fn test_add_more_than_two_hours_with_carry() { +fn add_more_than_two_hours_with_carry() { let clock = Clock::new(0, 45).add_minutes(160); assert_eq!(clock.to_string(), "03:25"); } #[test] #[ignore] -fn test_add_across_midnight() { +fn add_across_midnight() { let clock = Clock::new(23, 59).add_minutes(2); assert_eq!(clock.to_string(), "00:01"); } #[test] #[ignore] -fn test_add_more_than_one_day() { +fn add_more_than_one_day() { let clock = Clock::new(5, 32).add_minutes(1500); assert_eq!(clock.to_string(), "06:32"); } #[test] #[ignore] -fn test_add_more_than_two_days() { +fn add_more_than_two_days() { let clock = Clock::new(1, 1).add_minutes(3500); assert_eq!(clock.to_string(), "11:21"); } #[test] #[ignore] -fn test_subtract_minutes() { +fn subtract_minutes() { let clock = Clock::new(10, 3).add_minutes(-3); assert_eq!(clock.to_string(), "10:00"); } #[test] #[ignore] -fn test_subtract_to_previous_hour() { +fn subtract_to_previous_hour() { let clock = Clock::new(10, 3).add_minutes(-30); assert_eq!(clock.to_string(), "09:33"); } #[test] #[ignore] -fn test_subtract_more_than_an_hour() { +fn subtract_more_than_an_hour() { let clock = Clock::new(10, 3).add_minutes(-70); assert_eq!(clock.to_string(), "08:53"); } #[test] #[ignore] -fn test_subtract_across_midnight() { +fn subtract_across_midnight() { let clock = Clock::new(0, 3).add_minutes(-4); assert_eq!(clock.to_string(), "23:59"); } #[test] #[ignore] -fn test_subtract_more_than_two_hours() { +fn subtract_more_than_two_hours() { let clock = Clock::new(0, 0).add_minutes(-160); assert_eq!(clock.to_string(), "21:20"); } #[test] #[ignore] -fn test_subtract_more_than_two_hours_with_borrow() { +fn subtract_more_than_two_hours_with_borrow() { let clock = Clock::new(6, 15).add_minutes(-160); assert_eq!(clock.to_string(), "03:35"); } #[test] #[ignore] -fn test_subtract_more_than_one_day() { +fn subtract_more_than_one_day() { let clock = Clock::new(5, 32).add_minutes(-1500); assert_eq!(clock.to_string(), "04:32"); } #[test] #[ignore] -fn test_subtract_more_than_two_days() { +fn subtract_more_than_two_days() { let clock = Clock::new(2, 20).add_minutes(-3000); assert_eq!(clock.to_string(), "00:20"); } @@ -257,96 +257,96 @@ fn test_subtract_more_than_two_days() { #[test] #[ignore] -fn test_compare_clocks_for_equality() { +fn compare_clocks_for_equality() { assert_eq!(Clock::new(15, 37), Clock::new(15, 37)); } #[test] #[ignore] -fn test_compare_clocks_a_minute_apart() { +fn compare_clocks_a_minute_apart() { assert_ne!(Clock::new(15, 36), Clock::new(15, 37)); } #[test] #[ignore] -fn test_compare_clocks_an_hour_apart() { +fn compare_clocks_an_hour_apart() { assert_ne!(Clock::new(14, 37), Clock::new(15, 37)); } #[test] #[ignore] -fn test_compare_clocks_with_hour_overflow() { +fn compare_clocks_with_hour_overflow() { assert_eq!(Clock::new(10, 37), Clock::new(34, 37)); } #[test] #[ignore] -fn test_compare_clocks_with_hour_overflow_by_several_days() { +fn compare_clocks_with_hour_overflow_by_several_days() { assert_eq!(Clock::new(99, 11), Clock::new(3, 11)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_hour() { +fn compare_clocks_with_negative_hour() { assert_eq!(Clock::new(-2, 40), Clock::new(22, 40)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_hour_that_wraps() { +fn compare_clocks_with_negative_hour_that_wraps() { assert_eq!(Clock::new(-31, 3), Clock::new(17, 3)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_hour_that_wraps_multiple_times() { +fn compare_clocks_with_negative_hour_that_wraps_multiple_times() { assert_eq!(Clock::new(-83, 49), Clock::new(13, 49)); } #[test] #[ignore] -fn test_compare_clocks_with_minutes_overflow() { +fn compare_clocks_with_minutes_overflow() { assert_eq!(Clock::new(0, 1441), Clock::new(0, 1)); } #[test] #[ignore] -fn test_compare_clocks_with_minutes_overflow_by_several_days() { +fn compare_clocks_with_minutes_overflow_by_several_days() { assert_eq!(Clock::new(2, 4322), Clock::new(2, 2)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_minute() { +fn compare_clocks_with_negative_minute() { assert_eq!(Clock::new(3, -20), Clock::new(2, 40)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_minute_that_wraps() { +fn compare_clocks_with_negative_minute_that_wraps() { assert_eq!(Clock::new(5, -1490), Clock::new(4, 10)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_minute_that_wraps_multiple() { +fn compare_clocks_with_negative_minute_that_wraps_multiple() { assert_eq!(Clock::new(6, -4305), Clock::new(6, 15)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_hours_and_minutes() { +fn compare_clocks_with_negative_hours_and_minutes() { assert_eq!(Clock::new(-12, -268), Clock::new(7, 32)); } #[test] #[ignore] -fn test_compare_clocks_with_negative_hours_and_minutes_that_wrap() { +fn compare_clocks_with_negative_hours_and_minutes_that_wrap() { assert_eq!(Clock::new(-54, -11_513), Clock::new(18, 7)); } #[test] #[ignore] -fn test_compare_full_clock_and_zeroed_clock() { +fn compare_full_clock_and_zeroed_clock() { assert_eq!(Clock::new(24, 0), Clock::new(0, 0)); } diff --git a/exercises/practice/collatz-conjecture/tests/collatz-conjecture.rs b/exercises/practice/collatz-conjecture/tests/collatz-conjecture.rs index b78442270..9c6690dc2 100644 --- a/exercises/practice/collatz-conjecture/tests/collatz-conjecture.rs +++ b/exercises/practice/collatz-conjecture/tests/collatz-conjecture.rs @@ -1,31 +1,31 @@ use collatz_conjecture::*; #[test] -fn test_1() { +fn one() { assert_eq!(Some(0), collatz(1)); } #[test] #[ignore] -fn test_16() { +fn sixteen() { assert_eq!(Some(4), collatz(16)); } #[test] #[ignore] -fn test_12() { +fn twelve() { assert_eq!(Some(9), collatz(12)); } #[test] #[ignore] -fn test_1000000() { +fn one_million() { assert_eq!(Some(152), collatz(1_000_000)); } #[test] #[ignore] -fn test_0() { +fn zero() { assert_eq!(None, collatz(0)); } @@ -38,14 +38,14 @@ fn test_110243094271() { #[test] #[ignore] -fn test_max_div_3() { +fn max_div_3() { let max = u64::MAX / 3; assert_eq!(None, collatz(max)); } #[test] #[ignore] -fn test_max_minus_1() { +fn max_minus_1() { let max = u64::MAX - 1; assert_eq!(None, collatz(max)); } diff --git a/exercises/practice/crypto-square/tests/crypto-square.rs b/exercises/practice/crypto-square/tests/crypto-square.rs index ba65c2e43..ebe67f3a9 100644 --- a/exercises/practice/crypto-square/tests/crypto-square.rs +++ b/exercises/practice/crypto-square/tests/crypto-square.rs @@ -5,13 +5,13 @@ fn test(input: &str, output: &str) { } #[test] -fn test_empty_input() { +fn empty_input() { test("", "") } #[test] #[ignore] -fn test_encrypt_also_decrypts_square() { +fn encrypt_also_decrypts_square() { // note that you only get the exact input back if: // 1. no punctuation // 2. even spacing @@ -23,7 +23,7 @@ fn test_encrypt_also_decrypts_square() { #[test] #[ignore] -fn test_example() { +fn example() { test( "If man was meant to stay on the ground, god would have given us roots.", "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ", @@ -32,13 +32,13 @@ fn test_example() { #[test] #[ignore] -fn test_empty_last_line() { +fn empty_last_line() { test("congratulate", "crl oaa ntt gue") } #[test] #[ignore] -fn test_spaces_are_reorganized() { +fn spaces_are_reorganized() { test("abet", "ae bt"); test("a bet", "ae bt"); test(" a b e t ", "ae bt"); @@ -46,7 +46,7 @@ fn test_spaces_are_reorganized() { #[test] #[ignore] -fn test_everything_becomes_lowercase() { +fn everything_becomes_lowercase() { test("caSe", "cs ae"); test("cAsE", "cs ae"); test("CASE", "cs ae"); @@ -54,7 +54,7 @@ fn test_everything_becomes_lowercase() { #[test] #[ignore] -fn test_long() { +fn long() { test( r#" We choose to go to the moon. diff --git a/exercises/practice/decimal/.meta/example.rs b/exercises/practice/decimal/.meta/example.rs index 7f8c3faf7..e6c7d4c4e 100644 --- a/exercises/practice/decimal/.meta/example.rs +++ b/exercises/practice/decimal/.meta/example.rs @@ -171,7 +171,7 @@ mod tests { use super::*; #[test] - fn test_display_temp() { + fn display_temp() { for &test_str in &["0", "1", "20", "0.3", "0.04", "50.05", "66.0006", "0.007"] { println!( "Decimal representation of \"{}\": {}", diff --git a/exercises/practice/decimal/tests/decimal.rs b/exercises/practice/decimal/tests/decimal.rs index 02823fc3a..74a11e1c8 100644 --- a/exercises/practice/decimal/tests/decimal.rs +++ b/exercises/practice/decimal/tests/decimal.rs @@ -16,7 +16,7 @@ const BIGS: [&str; 3] = [ // test simple properties of required operations #[test] -fn test_eq() { +fn eq() { assert!(decimal("0.0") == decimal("0.0")); assert!(decimal("1.0") == decimal("1.0")); for big in BIGS.iter() { @@ -26,14 +26,14 @@ fn test_eq() { #[test] #[ignore] -fn test_ne() { +fn ne() { assert!(decimal("0.0") != decimal("1.0")); assert!(decimal(BIGS[0]) != decimal(BIGS[1])); } #[test] #[ignore] -fn test_gt() { +fn gt() { for slice_2 in BIGS.windows(2) { assert!(decimal(slice_2[1]) > decimal(slice_2[0])); } @@ -41,7 +41,7 @@ fn test_gt() { #[test] #[ignore] -fn test_lt() { +fn lt() { for slice_2 in BIGS.windows(2) { assert!(decimal(slice_2[0]) < decimal(slice_2[1])); } @@ -49,7 +49,7 @@ fn test_lt() { #[test] #[ignore] -fn test_add() { +fn add() { assert_eq!(decimal("0.1") + decimal("0.2"), decimal("0.3")); assert_eq!(decimal(BIGS[0]) + decimal(BIGS[1]), decimal(BIGS[2])); assert_eq!(decimal(BIGS[1]) + decimal(BIGS[0]), decimal(BIGS[2])); @@ -57,14 +57,14 @@ fn test_add() { #[test] #[ignore] -fn test_sub() { +fn sub() { assert_eq!(decimal(BIGS[2]) - decimal(BIGS[1]), decimal(BIGS[0])); assert_eq!(decimal(BIGS[2]) - decimal(BIGS[0]), decimal(BIGS[1])); } #[test] #[ignore] -fn test_mul() { +fn mul() { for big in BIGS.iter() { assert_eq!(decimal(big) * decimal("2"), decimal(big) + decimal(big)); } @@ -73,7 +73,7 @@ fn test_mul() { // test identities #[test] #[ignore] -fn test_add_id() { +fn add_id() { assert_eq!(decimal("1.0") + decimal("0.0"), decimal("1.0")); assert_eq!(decimal("0.1") + decimal("0.0"), decimal("0.1")); assert_eq!(decimal("0.0") + decimal("1.0"), decimal("1.0")); @@ -82,28 +82,28 @@ fn test_add_id() { #[test] #[ignore] -fn test_sub_id() { +fn sub_id() { assert_eq!(decimal("1.0") - decimal("0.0"), decimal("1.0")); assert_eq!(decimal("0.1") - decimal("0.0"), decimal("0.1")); } #[test] #[ignore] -fn test_mul_id() { +fn mul_id() { assert_eq!(decimal("2.1") * decimal("1.0"), decimal("2.1")); assert_eq!(decimal("1.0") * decimal("2.1"), decimal("2.1")); } #[test] #[ignore] -fn test_gt_positive_and_zero() { +fn gt_positive_and_zero() { assert!(decimal("1.0") > decimal("0.0")); assert!(decimal("0.1") > decimal("0.0")); } #[test] #[ignore] -fn test_gt_negative_and_zero() { +fn gt_negative_and_zero() { assert!(decimal("0.0") > decimal("-0.1")); assert!(decimal("0.0") > decimal("-1.0")); } @@ -111,20 +111,20 @@ fn test_gt_negative_and_zero() { // tests of arbitrary precision behavior #[test] #[ignore] -fn test_add_uneven_position() { +fn add_uneven_position() { assert_eq!(decimal("0.1") + decimal("0.02"), decimal("0.12")); } #[test] #[ignore] -fn test_eq_vary_sig_digits() { +fn eq_vary_sig_digits() { assert!(decimal("0") == decimal("0000000000000.0000000000000000000000")); assert!(decimal("1") == decimal("00000000000000001.000000000000000000")); } #[test] #[ignore] -fn test_add_vary_precision() { +fn add_vary_precision() { assert_eq!( decimal("100000000000000000000000000000000000000000000") + decimal("0.00000000000000000000000000000000000000001"), @@ -134,7 +134,7 @@ fn test_add_vary_precision() { #[test] #[ignore] -fn test_cleanup_precision() { +fn cleanup_precision() { assert_eq!( decimal("10000000000000000000000000000000000000000000000.999999999999999999999999998",) + decimal( @@ -146,7 +146,7 @@ fn test_cleanup_precision() { #[test] #[ignore] -fn test_gt_varying_positive_precisions() { +fn gt_varying_positive_precisions() { assert!(decimal("1.1") > decimal("1.01")); assert!(decimal("1.01") > decimal("1.0")); assert!(decimal("1.0") > decimal("0.1")); @@ -155,7 +155,7 @@ fn test_gt_varying_positive_precisions() { #[test] #[ignore] -fn test_gt_positive_and_negative() { +fn gt_positive_and_negative() { assert!(decimal("1.0") > decimal("-1.0")); assert!(decimal("1.1") > decimal("-1.1")); assert!(decimal("0.1") > decimal("-0.1")); @@ -163,7 +163,7 @@ fn test_gt_positive_and_negative() { #[test] #[ignore] -fn test_gt_varying_negative_precisions() { +fn gt_varying_negative_precisions() { assert!(decimal("-0.01") > decimal("-0.1")); assert!(decimal("-0.1") > decimal("-1.0")); assert!(decimal("-1.0") > decimal("-1.01")); @@ -173,7 +173,7 @@ fn test_gt_varying_negative_precisions() { // test signed properties #[test] #[ignore] -fn test_negatives() { +fn negatives() { assert!(Decimal::try_from("-1").is_some()); assert_eq!(decimal("0") - decimal("1"), decimal("-1")); assert_eq!(decimal("5.5") + decimal("-6.5"), decimal("-1")); @@ -181,21 +181,21 @@ fn test_negatives() { #[test] #[ignore] -fn test_explicit_positive() { +fn explicit_positive() { assert_eq!(decimal("+1"), decimal("1")); assert_eq!(decimal("+2.0") - decimal("-0002.0"), decimal("4")); } #[test] #[ignore] -fn test_multiply_by_negative() { +fn multiply_by_negative() { assert_eq!(decimal("5") * decimal("-0.2"), decimal("-1")); assert_eq!(decimal("-20") * decimal("-0.2"), decimal("4")); } #[test] #[ignore] -fn test_simple_partial_cmp() { +fn simple_partial_cmp() { assert!(decimal("1.0") < decimal("1.1")); assert!(decimal("0.00000000000000000000001") > decimal("-20000000000000000000000000000")); } @@ -205,122 +205,122 @@ fn test_simple_partial_cmp() { // integer and fractional parts of the number are stored separately #[test] #[ignore] -fn test_carry_into_integer() { +fn carry_into_integer() { assert_eq!(decimal("0.901") + decimal("0.1"), decimal("1.001")) } #[test] #[ignore] -fn test_carry_into_fractional_with_digits_to_right() { +fn carry_into_fractional_with_digits_to_right() { assert_eq!(decimal("0.0901") + decimal("0.01"), decimal("0.1001")) } #[test] #[ignore] -fn test_add_carry_over_negative() { +fn add_carry_over_negative() { assert_eq!(decimal("-1.99") + decimal("-0.01"), decimal("-2.0")) } #[test] #[ignore] -fn test_sub_carry_over_negative() { +fn sub_carry_over_negative() { assert_eq!(decimal("-1.99") - decimal("0.01"), decimal("-2.0")) } #[test] #[ignore] -fn test_add_carry_over_negative_with_fractional() { +fn add_carry_over_negative_with_fractional() { assert_eq!(decimal("-1.99") + decimal("-0.02"), decimal("-2.01")) } #[test] #[ignore] -fn test_sub_carry_over_negative_with_fractional() { +fn sub_carry_over_negative_with_fractional() { assert_eq!(decimal("-1.99") - decimal("0.02"), decimal("-2.01")) } #[test] #[ignore] -fn test_carry_from_rightmost_one() { +fn carry_from_rightmost_one() { assert_eq!(decimal("0.09") + decimal("0.01"), decimal("0.1")) } #[test] #[ignore] -fn test_carry_from_rightmost_more() { +fn carry_from_rightmost_more() { assert_eq!(decimal("0.099") + decimal("0.001"), decimal("0.1")) } #[test] #[ignore] -fn test_carry_from_rightmost_into_integer() { +fn carry_from_rightmost_into_integer() { assert_eq!(decimal("0.999") + decimal("0.001"), decimal("1.0")) } // test arithmetic borrow rules #[test] #[ignore] -fn test_add_borrow() { +fn add_borrow() { assert_eq!(decimal("0.01") + decimal("-0.0001"), decimal("0.0099")) } #[test] #[ignore] -fn test_sub_borrow() { +fn sub_borrow() { assert_eq!(decimal("0.01") - decimal("0.0001"), decimal("0.0099")) } #[test] #[ignore] -fn test_add_borrow_integral() { +fn add_borrow_integral() { assert_eq!(decimal("1.0") + decimal("-0.01"), decimal("0.99")) } #[test] #[ignore] -fn test_sub_borrow_integral() { +fn sub_borrow_integral() { assert_eq!(decimal("1.0") - decimal("0.01"), decimal("0.99")) } #[test] #[ignore] -fn test_add_borrow_integral_zeroes() { +fn add_borrow_integral_zeroes() { assert_eq!(decimal("1.0") + decimal("-0.99"), decimal("0.01")) } #[test] #[ignore] -fn test_sub_borrow_integral_zeroes() { +fn sub_borrow_integral_zeroes() { assert_eq!(decimal("1.0") - decimal("0.99"), decimal("0.01")) } #[test] #[ignore] -fn test_borrow_from_negative() { +fn borrow_from_negative() { assert_eq!(decimal("-1.0") + decimal("0.01"), decimal("-0.99")) } #[test] #[ignore] -fn test_add_into_fewer_digits() { +fn add_into_fewer_digits() { assert_eq!(decimal("0.011") + decimal("-0.001"), decimal("0.01")) } // misc tests of arithmetic properties #[test] #[ignore] -fn test_sub_into_fewer_digits() { +fn sub_into_fewer_digits() { assert_eq!(decimal("0.011") - decimal("0.001"), decimal("0.01")) } #[test] #[ignore] -fn test_add_away_decimal() { +fn add_away_decimal() { assert_eq!(decimal("1.1") + decimal("-0.1"), decimal("1.0")) } #[test] #[ignore] -fn test_sub_away_decimal() { +fn sub_away_decimal() { assert_eq!(decimal("1.1") - decimal("0.1"), decimal("1.0")) } diff --git a/exercises/practice/diamond/tests/diamond.rs b/exercises/practice/diamond/tests/diamond.rs index cb1c09005..2f18fc8a0 100644 --- a/exercises/practice/diamond/tests/diamond.rs +++ b/exercises/practice/diamond/tests/diamond.rs @@ -1,13 +1,13 @@ use diamond::*; #[test] -fn test_a() { +fn a() { assert_eq!(get_diamond('A'), vec!["A"]); } #[test] #[ignore] -fn test_b() { +fn b() { #[rustfmt::skip] assert_eq!( get_diamond('B'), @@ -21,7 +21,7 @@ fn test_b() { #[test] #[ignore] -fn test_c() { +fn c() { #[rustfmt::skip] assert_eq!( get_diamond('C'), @@ -37,7 +37,7 @@ fn test_c() { #[test] #[ignore] -fn test_d() { +fn d() { #[rustfmt::skip] assert_eq!( get_diamond('D'), @@ -55,7 +55,7 @@ fn test_d() { #[test] #[ignore] -fn test_e() { +fn e() { assert_eq!( get_diamond('Z'), vec![ diff --git a/exercises/practice/difference-of-squares/tests/difference-of-squares.rs b/exercises/practice/difference-of-squares/tests/difference-of-squares.rs index 552b9c4de..672faaee0 100644 --- a/exercises/practice/difference-of-squares/tests/difference-of-squares.rs +++ b/exercises/practice/difference-of-squares/tests/difference-of-squares.rs @@ -1,54 +1,54 @@ use difference_of_squares as squares; #[test] -fn test_square_of_sum_1() { +fn square_of_sum_1() { assert_eq!(1, squares::square_of_sum(1)); } #[test] #[ignore] -fn test_square_of_sum_5() { +fn square_of_sum_5() { assert_eq!(225, squares::square_of_sum(5)); } #[test] #[ignore] -fn test_square_of_sum_100() { +fn square_of_sum_100() { assert_eq!(25_502_500, squares::square_of_sum(100)); } #[test] #[ignore] -fn test_sum_of_squares_1() { +fn sum_of_squares_1() { assert_eq!(1, squares::sum_of_squares(1)); } #[test] #[ignore] -fn test_sum_of_squares_5() { +fn sum_of_squares_5() { assert_eq!(55, squares::sum_of_squares(5)); } #[test] #[ignore] -fn test_sum_of_squares_100() { +fn sum_of_squares_100() { assert_eq!(338_350, squares::sum_of_squares(100)); } #[test] #[ignore] -fn test_difference_1() { +fn difference_1() { assert_eq!(0, squares::difference(1)); } #[test] #[ignore] -fn test_difference_5() { +fn difference_5() { assert_eq!(170, squares::difference(5)); } #[test] #[ignore] -fn test_difference_100() { +fn difference_100() { assert_eq!(25_164_150, squares::difference(100)); } diff --git a/exercises/practice/diffie-hellman/tests/diffie-hellman.rs b/exercises/practice/diffie-hellman/tests/diffie-hellman.rs index 5c7504304..da338d9a0 100644 --- a/exercises/practice/diffie-hellman/tests/diffie-hellman.rs +++ b/exercises/practice/diffie-hellman/tests/diffie-hellman.rs @@ -1,7 +1,7 @@ use diffie_hellman::*; #[test] -fn test_private_key_in_range_key() { +fn private_key_in_range_key() { let primes: Vec = vec![ 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 773, 967, 3461, 6131, ]; @@ -14,7 +14,7 @@ fn test_private_key_in_range_key() { #[test] #[ignore] -fn test_public_key_correct() { +fn public_key_correct() { let p: u64 = 23; let g: u64 = 5; @@ -26,7 +26,7 @@ fn test_public_key_correct() { #[test] #[ignore] -fn test_secret_key_correct() { +fn secret_key_correct() { let p: u64 = 11; let private_key_a = 7; @@ -39,7 +39,7 @@ fn test_secret_key_correct() { #[test] #[ignore] -fn test_public_key_correct_big_numbers() { +fn public_key_correct_big_numbers() { let p: u64 = 4_294_967_299; let g: u64 = 8; @@ -53,7 +53,7 @@ fn test_public_key_correct_big_numbers() { #[test] #[ignore] -fn test_secret_key_correct_big_numbers() { +fn secret_key_correct_big_numbers() { let p: u64 = 4_294_967_927; let private_key_a = 4_294_967_300; @@ -80,7 +80,7 @@ const PUBLIC_KEY_64BIT: u64 = 0xB851_EB85_1EB8_51C1; #[test] #[ignore] #[cfg(feature = "big-primes")] -fn test_public_key_correct_biggest_numbers() { +fn public_key_correct_biggest_numbers() { assert_eq!( public_key(PRIME_64BIT_1, PRIME_64BIT_2, PRIVATE_KEY_64BIT), PUBLIC_KEY_64BIT @@ -90,7 +90,7 @@ fn test_public_key_correct_biggest_numbers() { #[test] #[ignore] #[cfg(feature = "big-primes")] -fn test_secret_key_correct_biggest_numbers() { +fn secret_key_correct_biggest_numbers() { let private_key_b = 0xEFFF_FFFF_FFFF_FFC0; let public_key_b = public_key(PRIME_64BIT_1, PRIME_64BIT_2, private_key_b); @@ -111,7 +111,7 @@ fn test_secret_key_correct_biggest_numbers() { #[test] #[ignore] #[cfg(feature = "big-primes")] -fn test_changed_secret_key_biggest_numbers() { +fn changed_secret_key_biggest_numbers() { let private_key_a = private_key(PRIME_64BIT_1); let public_key_a = public_key(PRIME_64BIT_1, PRIME_64BIT_2, private_key_a); @@ -126,7 +126,7 @@ fn test_changed_secret_key_biggest_numbers() { #[test] #[ignore] -fn test_changed_secret_key() { +fn changed_secret_key() { let p: u64 = 13; let g: u64 = 11; diff --git a/exercises/practice/dot-dsl/tests/dot-dsl.rs b/exercises/practice/dot-dsl/tests/dot-dsl.rs index cadd478e8..9bf673a87 100644 --- a/exercises/practice/dot-dsl/tests/dot-dsl.rs +++ b/exercises/practice/dot-dsl/tests/dot-dsl.rs @@ -4,7 +4,7 @@ use dot_dsl::graph::Graph; use maplit::hashmap; #[test] -fn test_empty_graph() { +fn empty_graph() { let graph = Graph::new(); assert!(graph.nodes.is_empty()); @@ -16,7 +16,7 @@ fn test_empty_graph() { #[test] #[ignore] -fn test_graph_with_one_node() { +fn graph_with_one_node() { let nodes = vec![Node::new("a")]; let graph = Graph::new().with_nodes(&nodes); @@ -30,7 +30,7 @@ fn test_graph_with_one_node() { #[test] #[ignore] -fn test_graph_with_one_node_with_keywords() { +fn graph_with_one_node_with_keywords() { let nodes = vec![Node::new("a").with_attrs(&[("color", "green")])]; let graph = Graph::new().with_nodes(&nodes); @@ -47,7 +47,7 @@ fn test_graph_with_one_node_with_keywords() { #[test] #[ignore] -fn test_graph_with_one_edge() { +fn graph_with_one_edge() { let edges = vec![Edge::new("a", "b")]; let graph = Graph::new().with_edges(&edges); @@ -61,7 +61,7 @@ fn test_graph_with_one_edge() { #[test] #[ignore] -fn test_graph_with_one_edge_with_keywords() { +fn graph_with_one_edge_with_keywords() { let edges = vec![Edge::new("a", "b").with_attrs(&[("color", "blue")])]; let graph = Graph::new().with_edges(&edges); @@ -78,7 +78,7 @@ fn test_graph_with_one_edge_with_keywords() { #[test] #[ignore] -fn test_graph_with_one_attribute() { +fn graph_with_one_attribute() { let graph = Graph::new().with_attrs(&[("foo", "1")]); let expected_attrs = hashmap! { @@ -94,7 +94,7 @@ fn test_graph_with_one_attribute() { #[test] #[ignore] -fn test_graph_with_attributes() { +fn graph_with_attributes() { let nodes = vec![ Node::new("a").with_attrs(&[("color", "green")]), Node::new("c"), @@ -141,7 +141,7 @@ fn test_graph_with_attributes() { #[test] #[ignore] -fn test_edges_store_attributes() { +fn edges_store_attributes() { let nodes = vec![ Node::new("a").with_attrs(&[("color", "green")]), Node::new("c"), @@ -178,7 +178,7 @@ fn test_edges_store_attributes() { #[test] #[ignore] -fn test_graph_nodes_store_attributes() { +fn graph_nodes_store_attributes() { let attributes = [("foo", "bar"), ("bat", "baz"), ("bim", "bef")]; let graph = Graph::new().with_nodes( &["a", "b", "c"] diff --git a/exercises/practice/etl/tests/etl.rs b/exercises/practice/etl/tests/etl.rs index 37241247e..e1324990d 100644 --- a/exercises/practice/etl/tests/etl.rs +++ b/exercises/practice/etl/tests/etl.rs @@ -1,7 +1,7 @@ use std::collections::BTreeMap; #[test] -fn test_transform_one_value() { +fn transform_one_value() { let input = input_from(&[(1, vec!['A'])]); let expected = expected_from(&[('a', 1)]); @@ -11,7 +11,7 @@ fn test_transform_one_value() { #[test] #[ignore] -fn test_transform_more_values() { +fn transform_more_values() { let input = input_from(&[(1, vec!['A', 'E', 'I', 'O', 'U'])]); let expected = expected_from(&[('a', 1), ('e', 1), ('i', 1), ('o', 1), ('u', 1)]); @@ -21,7 +21,7 @@ fn test_transform_more_values() { #[test] #[ignore] -fn test_more_keys() { +fn more_keys() { let input = input_from(&[(1, vec!['A', 'E']), (2, vec!['D', 'G'])]); let expected = expected_from(&[('a', 1), ('e', 1), ('d', 2), ('g', 2)]); @@ -31,7 +31,7 @@ fn test_more_keys() { #[test] #[ignore] -fn test_full_dataset() { +fn full_dataset() { let input = input_from(&[ (1, vec!['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T']), (2, vec!['D', 'G']), diff --git a/exercises/practice/fizzy/.meta/example.rs b/exercises/practice/fizzy/.meta/example.rs index 0d11f9411..28e2dee98 100644 --- a/exercises/practice/fizzy/.meta/example.rs +++ b/exercises/practice/fizzy/.meta/example.rs @@ -85,7 +85,7 @@ mod test { use super::*; #[test] - fn test_fizz_buzz() { + fn fizz_buzz_i32() { let expect = vec![ "1", "2", "fizz", "4", "buzz", "fizz", "7", "8", "fizz", "buzz", "11", "fizz", "13", "14", "fizzbuzz", "16", @@ -95,7 +95,7 @@ mod test { } #[test] - fn test_fizz_buzz_u8() { + fn fizz_buzz_u8() { let expect = vec![ "1", "2", "fizz", "4", "buzz", "fizz", "7", "8", "fizz", "buzz", "11", "fizz", "13", "14", "fizzbuzz", "16", @@ -105,7 +105,7 @@ mod test { } #[test] - fn test_fizz_buzz_u64() { + fn fizz_buzz_u64() { let expect = vec![ "1", "2", "fizz", "4", "buzz", "fizz", "7", "8", "fizz", "buzz", "11", "fizz", "13", "14", "fizzbuzz", "16", @@ -115,7 +115,7 @@ mod test { } #[test] - fn test_fizz_buzz_nonsequential() { + fn fizz_buzz_nonsequential() { let collatz_12 = &[12, 6, 3, 10, 5, 16, 8, 4, 2, 1]; let expect = vec![ "fizz", "fizz", "fizz", "buzz", "buzz", "16", "8", "4", "2", "1", @@ -127,7 +127,7 @@ mod test { } #[test] - fn test_fizz_buzz_custom() { + fn fizz_buzz_custom() { let expect = vec![ "1", "2", "Fizz", "4", "Buzz", "Fizz", "Bam", "8", "Fizz", "Buzz", "11", "Fizz", "13", "Bam", "BuzzFizz", "16", @@ -142,7 +142,7 @@ mod test { } #[test] - fn test_map() { + fn map() { let expect = vec![ "1", "2", "fizz", "4", "buzz", "fizz", "7", "8", "fizz", "buzz", "11", "fizz", "13", "14", "fizzbuzz", "16", @@ -155,7 +155,7 @@ mod test { } #[test] - fn test_fizz_buzz_f64() { + fn fizz_buzz_f64() { let expect = vec![ "1", "2", "fizz", "4", "buzz", "fizz", "7", "8", "fizz", "buzz", "11", "fizz", "13", "14", "fizzbuzz", "16", diff --git a/exercises/practice/fizzy/tests/fizzy.rs b/exercises/practice/fizzy/tests/fizzy.rs index 85a7f8adb..f496ca45b 100644 --- a/exercises/practice/fizzy/tests/fizzy.rs +++ b/exercises/practice/fizzy/tests/fizzy.rs @@ -10,28 +10,28 @@ macro_rules! expect { } #[test] -fn test_simple() { +fn simple() { let got = fizz_buzz::().apply(1..=16).collect::>(); assert_eq!(expect!(), got); } #[test] #[ignore] -fn test_u8() { +fn u8() { let got = fizz_buzz::().apply(1_u8..=16).collect::>(); assert_eq!(expect!(), got); } #[test] #[ignore] -fn test_u64() { +fn u64() { let got = fizz_buzz::().apply(1_u64..=16).collect::>(); assert_eq!(expect!(), got); } #[test] #[ignore] -fn test_nonsequential() { +fn nonsequential() { let collatz_12 = &[12, 6, 3, 10, 5, 16, 8, 4, 2, 1]; let expect = vec![ "fizz", "fizz", "fizz", "buzz", "buzz", "16", "8", "4", "2", "1", @@ -44,7 +44,7 @@ fn test_nonsequential() { #[test] #[ignore] -fn test_custom() { +fn custom() { let expect = vec![ "1", "2", "Fizz", "4", "Buzz", "Fizz", "Bam", "8", "Fizz", "Buzz", "11", "Fizz", "13", "Bam", "BuzzFizz", "16", @@ -59,7 +59,7 @@ fn test_custom() { #[test] #[ignore] -fn test_f64() { +fn f64() { // a tiny bit more complicated becuase range isn't natively implemented on floats // NOTE: this test depends on a language feature introduced in Rust 1.34. If you // have an older compiler, upgrade. If you have an older compiler and cannot upgrade, @@ -73,7 +73,7 @@ fn test_f64() { #[test] #[ignore] -fn test_minimal_generic_bounds() { +fn minimal_generic_bounds() { // NOTE: this test depends on a language feature introduced in Rust 1.34. If you // have an older compiler, upgrade. If you have an older compiler and cannot upgrade, // feel free to ignore this test. diff --git a/exercises/practice/gigasecond/tests/gigasecond.rs b/exercises/practice/gigasecond/tests/gigasecond.rs index abd53a882..52237cf8b 100644 --- a/exercises/practice/gigasecond/tests/gigasecond.rs +++ b/exercises/practice/gigasecond/tests/gigasecond.rs @@ -13,7 +13,7 @@ fn dt(year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8) -> DateTi } #[test] -fn test_date() { +fn date() { let start_date = dt(2011, 4, 25, 0, 0, 0); assert_eq!(gigasecond::after(start_date), dt(2043, 1, 1, 1, 46, 40)); @@ -21,7 +21,7 @@ fn test_date() { #[test] #[ignore] -fn test_another_date() { +fn another_date() { let start_date = dt(1977, 6, 13, 0, 0, 0); assert_eq!(gigasecond::after(start_date), dt(2009, 2, 19, 1, 46, 40)); @@ -29,7 +29,7 @@ fn test_another_date() { #[test] #[ignore] -fn test_third_date() { +fn third_date() { let start_date = dt(1959, 7, 19, 0, 0, 0); assert_eq!(gigasecond::after(start_date), dt(1991, 3, 27, 1, 46, 40)); @@ -37,7 +37,7 @@ fn test_third_date() { #[test] #[ignore] -fn test_datetime() { +fn datetime() { let start_date = dt(2015, 1, 24, 22, 0, 0); assert_eq!(gigasecond::after(start_date), dt(2046, 10, 2, 23, 46, 40)); @@ -45,7 +45,7 @@ fn test_datetime() { #[test] #[ignore] -fn test_another_datetime() { +fn another_datetime() { let start_date = dt(2015, 1, 24, 23, 59, 59); assert_eq!(gigasecond::after(start_date), dt(2046, 10, 3, 1, 46, 39)); diff --git a/exercises/practice/grade-school/tests/grade-school.rs b/exercises/practice/grade-school/tests/grade-school.rs index eb41d0789..3d8a2d51b 100644 --- a/exercises/practice/grade-school/tests/grade-school.rs +++ b/exercises/practice/grade-school/tests/grade-school.rs @@ -5,14 +5,14 @@ fn to_owned(v: &[&str]) -> Vec { } #[test] -fn test_grades_for_empty_school() { +fn grades_for_empty_school() { let s = school::School::new(); assert_eq!(s.grades(), vec![]); } #[test] #[ignore] -fn test_grades_for_one_student() { +fn grades_for_one_student() { let mut s = school::School::new(); s.add(2, "Aimee"); assert_eq!(s.grades(), vec![2]); @@ -20,7 +20,7 @@ fn test_grades_for_one_student() { #[test] #[ignore] -fn test_grades_for_several_students_are_sorted() { +fn grades_for_several_students_are_sorted() { let mut s = school::School::new(); s.add(2, "Aimee"); s.add(7, "Logan"); @@ -30,7 +30,7 @@ fn test_grades_for_several_students_are_sorted() { #[test] #[ignore] -fn test_grades_when_several_students_have_the_same_grade() { +fn grades_when_several_students_have_the_same_grade() { let mut s = school::School::new(); s.add(2, "Aimee"); s.add(2, "Logan"); @@ -40,14 +40,14 @@ fn test_grades_when_several_students_have_the_same_grade() { #[test] #[ignore] -fn test_grade_for_empty_school() { +fn grade_for_empty_school() { let s = school::School::new(); assert_eq!(s.grade(1), Vec::::new()); } #[test] #[ignore] -fn test_grade_when_no_students_have_that_grade() { +fn grade_when_no_students_have_that_grade() { let mut s = school::School::new(); s.add(7, "Logan"); assert_eq!(s.grade(1), Vec::::new()); @@ -55,7 +55,7 @@ fn test_grade_when_no_students_have_that_grade() { #[test] #[ignore] -fn test_grade_for_one_student() { +fn grade_for_one_student() { let mut s = school::School::new(); s.add(2, "Aimee"); assert_eq!(s.grade(2), to_owned(&["Aimee"])); @@ -63,7 +63,7 @@ fn test_grade_for_one_student() { #[test] #[ignore] -fn test_grade_returns_students_sorted_by_name() { +fn grade_returns_students_sorted_by_name() { let mut s = school::School::new(); s.add(2, "James"); s.add(2, "Blair"); @@ -73,7 +73,7 @@ fn test_grade_returns_students_sorted_by_name() { #[test] #[ignore] -fn test_add_students_to_different_grades() { +fn add_students_to_different_grades() { let mut s = school::School::new(); s.add(3, "Chelsea"); s.add(7, "Logan"); diff --git a/exercises/practice/grains/.articles/performance/code/main.rs b/exercises/practice/grains/.articles/performance/code/main.rs index 3da5fcdcd..f62261bb0 100644 --- a/exercises/practice/grains/.articles/performance/code/main.rs +++ b/exercises/practice/grains/.articles/performance/code/main.rs @@ -41,31 +41,31 @@ pub fn total_pow_for() -> u64 { } #[bench] -fn test_square_bit(b: &mut Bencher) { +fn square_bit(b: &mut Bencher) { b.iter(|| square_bit(64)); } #[bench] -fn test_total_bit(b: &mut Bencher) { +fn total_bit(b: &mut Bencher) { b.iter(|| total_bit()); } #[bench] -fn test_square_pow(b: &mut Bencher) { +fn square_pow(b: &mut Bencher) { b.iter(|| square_pow(64)); } #[bench] -fn test_total_pow_u128(b: &mut Bencher) { +fn total_pow_u128(b: &mut Bencher) { b.iter(|| total_pow_u128()); } #[bench] -fn test_total_pow_fold(b: &mut Bencher) { +fn total_pow_fold(b: &mut Bencher) { b.iter(|| total_pow_fold()); } #[bench] -fn test_total_pow_for(b: &mut Bencher) { +fn total_pow_for(b: &mut Bencher) { b.iter(|| total_pow_for()); } diff --git a/exercises/practice/grains/.articles/performance/content.md b/exercises/practice/grains/.articles/performance/content.md index a337edcdd..a29997f72 100644 --- a/exercises/practice/grains/.articles/performance/content.md +++ b/exercises/practice/grains/.articles/performance/content.md @@ -14,12 +14,12 @@ Varieties of `pow` that iterate and call `square` were also benchmarked. To benchmark the approaches, we wrote a [small benchmark application][benchmark-application]. ``` -test test_square_bit ... bench: 0 ns/iter (+/- 0) -test test_total_bit ... bench: 0 ns/iter (+/- 0) -test test_square_pow ... bench: 0 ns/iter (+/- 0) -test test_total_pow_u128 ... bench: 0 ns/iter (+/- 0) -test test_total_pow_fold ... bench: 215 ns/iter (+/- 7) -test test_total_pow_for ... bench: 263 ns/iter (+/- 46) +test square_bit ... bench: 0 ns/iter (+/- 0) +test total_bit ... bench: 0 ns/iter (+/- 0) +test square_pow ... bench: 0 ns/iter (+/- 0) +test total_pow_u128 ... bench: 0 ns/iter (+/- 0) +test total_pow_fold ... bench: 215 ns/iter (+/- 7) +test total_pow_for ... bench: 263 ns/iter (+/- 46) ``` `pow` and bit shifting have the same measurable performance. diff --git a/exercises/practice/grains/.articles/performance/snippet.md b/exercises/practice/grains/.articles/performance/snippet.md index 5dac649d6..0c860e75d 100644 --- a/exercises/practice/grains/.articles/performance/snippet.md +++ b/exercises/practice/grains/.articles/performance/snippet.md @@ -1,8 +1,8 @@ ``` -test test_square_bit ... bench: 0 ns/iter (+/- 0) -test test_total_bit ... bench: 0 ns/iter (+/- 0) -test test_square_pow ... bench: 0 ns/iter (+/- 0) -test test_total_pow_u128 ... bench: 0 ns/iter (+/- 0) -test test_total_pow_fold ... bench: 215 ns/iter (+/- 7) -test test_total_pow_for ... bench: 263 ns/iter (+/- 46) +test square_bit ... bench: 0 ns/iter (+/- 0) +test total_bit ... bench: 0 ns/iter (+/- 0) +test square_pow ... bench: 0 ns/iter (+/- 0) +test total_pow_u128 ... bench: 0 ns/iter (+/- 0) +test total_pow_fold ... bench: 215 ns/iter (+/- 7) +test total_pow_for ... bench: 263 ns/iter (+/- 46) ``` diff --git a/exercises/practice/grains/tests/grains.rs b/exercises/practice/grains/tests/grains.rs index d7eb53a2b..51e08b643 100644 --- a/exercises/practice/grains/tests/grains.rs +++ b/exercises/practice/grains/tests/grains.rs @@ -3,70 +3,62 @@ fn process_square_case(input: u32, expected: u64) { } #[test] -/// 1 -fn test_1() { +fn one() { process_square_case(1, 1); } #[test] #[ignore] -/// 2 -fn test_2() { +fn two() { process_square_case(2, 2); } #[test] #[ignore] -/// 3 -fn test_3() { +fn three() { process_square_case(3, 4); } #[test] #[ignore] -/// 4 -fn test_4() { +fn four() { process_square_case(4, 8); } -//NEW #[test] #[ignore] -/// 16 -fn test_16() { +fn sixteen() { process_square_case(16, 32_768); } #[test] #[ignore] -/// 32 -fn test_32() { +fn thirty_two() { process_square_case(32, 2_147_483_648); } #[test] #[ignore] -/// 64 -fn test_64() { +fn sixty_four() { process_square_case(64, 9_223_372_036_854_775_808); } #[test] #[ignore] #[should_panic(expected = "Square must be between 1 and 64")] -fn test_square_0_raises_an_exception() { +fn square_0_raises_an_exception() { grains::square(0); } #[test] #[ignore] #[should_panic(expected = "Square must be between 1 and 64")] -fn test_square_greater_than_64_raises_an_exception() { +fn square_greater_than_64_raises_an_exception() { grains::square(65); } #[test] #[ignore] -fn test_returns_the_total_number_of_grains_on_the_board() { +fn returns_the_total_number_of_grains_on_the_board() { assert_eq!(grains::total(), 18_446_744_073_709_551_615); } diff --git a/exercises/practice/grep/tests/grep.rs b/exercises/practice/grep/tests/grep.rs index 398c2d8a5..49a6060b7 100644 --- a/exercises/practice/grep/tests/grep.rs +++ b/exercises/practice/grep/tests/grep.rs @@ -102,9 +102,9 @@ fn tear_down_files(files: &[&str]) { /// This macro is here so that every test case had its own set of files to be used in test. /// The approach is to create required files for every test case and to append test name to the -/// file names (so for test with a name 'test_one_file_one_match_no_flags' and a required file +/// file names (so for test with a name 'one_file_one_match_no_flags' and a required file /// 'iliad.txt' there would be created a file with a name -/// 'test_one_file_one_match_no_flags_iliad.txt'). +/// 'one_file_one_match_no_flags_iliad.txt'). /// This allows us to create files for every test case with no intersection between them. /// /// A better way would be to create required set of files at the start of tests run and to @@ -161,24 +161,24 @@ fn process_grep_case(pattern: &str, flags: &[&str], files: &[&str], expected: &[ // Test returning a Result #[test] -fn test_nonexistent_file_returns_error() { +fn nonexistent_file_returns_error() { let pattern = "Agamemnon"; let flags = Flags::new(&[]); - let files = vec!["test_nonexistent_file_returns_error_iliad.txt"]; + let files = vec!["nonexistent_file_returns_error_iliad.txt"]; assert!(grep(pattern, &flags, &files).is_err()); } #[test] #[ignore] -fn test_grep_returns_result() { +fn grep_returns_result() { let pattern = "Agamemnon"; let flags = Flags::new(&[]); - let files = vec!["test_grep_returns_result_iliad.txt"]; + let files = vec!["grep_returns_result_iliad.txt"]; let test_fixture = Fixture::new(&files); @@ -192,7 +192,7 @@ fn test_grep_returns_result() { set_up_test_case!( #[test] #[ignore] - test_one_file_one_match_no_flags( + one_file_one_match_no_flags( pattern = "Agamemnon", flags = [], files = ["iliad.txt"], @@ -203,7 +203,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_one_match_print_line_numbers_flag( + one_file_one_match_print_line_numbers_flag( pattern = "Forbidden", flags = ["-n"], files = ["paradise_lost.txt"], @@ -214,7 +214,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_one_match_caseinsensitive_flag( + one_file_one_match_caseinsensitive_flag( pattern = "FORBIDDEN", flags = ["-i"], files = ["paradise_lost.txt"], @@ -225,7 +225,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_one_match_print_file_names_flag( + one_file_one_match_print_file_names_flag( pattern = "Forbidden", flags = ["-l"], files = ["paradise_lost.txt"], @@ -236,7 +236,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_one_match_match_entire_lines_flag( + one_file_one_match_match_entire_lines_flag( pattern = "With loss of Eden, till one greater Man", flags = ["-x"], files = ["paradise_lost.txt"], @@ -247,7 +247,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_one_match_multiple_flags( + one_file_one_match_multiple_flags( pattern = "OF ATREUS, Agamemnon, KIng of MEN.", flags = ["-x", "-i", "-n"], files = ["iliad.txt"], @@ -258,7 +258,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_several_matches_no_flags( + one_file_several_matches_no_flags( pattern = "may", flags = [], files = ["midsummer_night.txt"], @@ -273,7 +273,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_several_matches_print_line_numbers_flag( + one_file_several_matches_print_line_numbers_flag( pattern = "may", flags = ["-n"], files = ["midsummer_night.txt"], @@ -288,7 +288,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_several_matches_match_entire_lines_flag( + one_file_several_matches_match_entire_lines_flag( pattern = "may", flags = ["-x"], files = ["midsummer_night.txt"], @@ -299,7 +299,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_several_matches_caseinsensitive_flag( + one_file_several_matches_caseinsensitive_flag( pattern = "ACHILLES", flags = ["-i"], files = ["iliad.txt"], @@ -313,7 +313,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_several_matches_inverted_flag( + one_file_several_matches_inverted_flag( pattern = "Of", flags = ["-v"], files = ["paradise_lost.txt"], @@ -330,7 +330,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_no_matches_various_flags( + one_file_no_matches_various_flags( pattern = "Gandalf", flags = ["-n", "-l", "-x", "-i"], files = ["iliad.txt"], @@ -341,7 +341,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_several_matches_inverted_and_match_entire_lines_flags( + one_file_several_matches_inverted_and_match_entire_lines_flags( pattern = "Illustrious into Ades premature,", flags = ["-x", "-v"], files = ["iliad.txt"], @@ -361,7 +361,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_one_file_one_match_file_flag_takes_precedence_over_line_flag( + one_file_one_match_file_flag_takes_precedence_over_line_flag( pattern = "ten", flags = ["-n", "-l"], files = ["iliad.txt"], @@ -374,7 +374,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_one_match_no_flags( + multiple_files_one_match_no_flags( pattern = "Agamemnon", flags = [], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -385,7 +385,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_several_matches_no_flags( + multiple_files_several_matches_no_flags( pattern = "may", flags = [], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -400,7 +400,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_several_matches_print_line_numbers_flag( + multiple_files_several_matches_print_line_numbers_flag( pattern = "that", flags = ["-n"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -416,7 +416,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_one_match_print_file_names_flag( + multiple_files_one_match_print_file_names_flag( pattern = "who", flags = ["-l"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -427,7 +427,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_several_matches_caseinsensitive_flag( + multiple_files_several_matches_caseinsensitive_flag( pattern = "TO", flags = ["-i"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -449,7 +449,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_several_matches_caseinsensitive_flag_utf8( + multiple_files_several_matches_caseinsensitive_flag_utf8( pattern = "В", // This letter stands for cyrillic 'Ve' and not latin 'B'. Therefore there should be no matches from paradise_lost.txt flags = ["-i"], files = ["paradise_lost.txt", "in_the_white_night.txt"], @@ -465,7 +465,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_several_matches_inverted_flag( + multiple_files_several_matches_inverted_flag( pattern = "a", flags = ["-v"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -480,7 +480,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_one_match_match_entire_lines_flag( + multiple_files_one_match_match_entire_lines_flag( pattern = "But I beseech your grace that I may know", flags = ["-x"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -491,7 +491,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_one_match_multiple_flags( + multiple_files_one_match_multiple_flags( pattern = "WITH LOSS OF EDEN, TILL ONE GREATER MAN", flags = ["-n", "-i", "-x"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -502,7 +502,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_no_matches_various_flags( + multiple_files_no_matches_various_flags( pattern = "Frodo", flags = ["-n", "-i", "-x", "-l"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -513,7 +513,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_several_matches_file_flag_takes_precedence_over_line_number_flag( + multiple_files_several_matches_file_flag_takes_precedence_over_line_number_flag( pattern = "who", flags = ["-n", "-l"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], @@ -524,7 +524,7 @@ set_up_test_case!( set_up_test_case!( #[test] #[ignore] - test_multiple_files_several_matches_inverted_and_match_entire_lines_flags( + multiple_files_several_matches_inverted_and_match_entire_lines_flags( pattern = "Illustrious into Ades premature,", flags = ["-x", "-v"], files = ["iliad.txt", "midsummer_night.txt", "paradise_lost.txt"], diff --git a/exercises/practice/hamming/tests/hamming.rs b/exercises/practice/hamming/tests/hamming.rs index 3e744ccd2..bcccb8311 100644 --- a/exercises/practice/hamming/tests/hamming.rs +++ b/exercises/practice/hamming/tests/hamming.rs @@ -6,84 +6,84 @@ fn process_distance_case(strand_pair: [&str; 2], expected_distance: Option bool { } #[bench] -fn test_check_hash(b: &mut Bencher) { +fn check_hash(b: &mut Bencher) { b.iter(|| check_hash("thumbscrew-japingly")); } #[bench] -fn test_check_bits(b: &mut Bencher) { +fn check_bits(b: &mut Bencher) { b.iter(|| check_bits("thumbscrew-japingly")); } #[bench] -fn test_check_bits_func(b: &mut Bencher) { +fn check_bits_func(b: &mut Bencher) { b.iter(|| check_bits_func("thumbscrew-japingly")); } #[bench] -fn test_check_hash_filtermap(b: &mut Bencher) { +fn check_hash_filtermap(b: &mut Bencher) { b.iter(|| check_hash_filtermap("thumbscrew-japingly")); } #[bench] -fn test_check_bits_func_filter_map(b: &mut Bencher) { +fn check_bits_func_filter_map(b: &mut Bencher) { b.iter(|| check_bits_func_filter_map("thumbscrew-japingly")); } #[bench] -fn test_check_hash_unicode(b: &mut Bencher) { +fn check_hash_unicode(b: &mut Bencher) { b.iter(|| check_hash_unicode("thumbscrew-japingly")); } diff --git a/exercises/practice/isogram/.articles/performance/content.md b/exercises/practice/isogram/.articles/performance/content.md index ed5f0c135..6a780051b 100644 --- a/exercises/practice/isogram/.articles/performance/content.md +++ b/exercises/practice/isogram/.articles/performance/content.md @@ -17,12 +17,12 @@ At the time of this writing, all tests use [ASCII][ascii] characters, so the let To benchmark the approaches, we wrote a [small benchmark application][benchmark-application]. ``` -test test_check_hash ... bench: 952 ns/iter (+/- 176) // using filter, then map -test test_check_bits ... bench: 17 ns/iter (+/- 3) -test test_check_bits_func ... bench: 22 ns/iter (+/- 4) // using filter_map -test test_check_hash_filtermap ... bench: 970 ns/iter (+/- 216) // using filter_map -test test_check_bits_func_filter_map ... bench: 37 ns/iter (+/- 7) // using filter, then map -test test_check_hash_unicode ... bench: 1,052 ns/iter (+/- 327) +test check_hash ... bench: 952 ns/iter (+/- 176) // using filter, then map +test check_bits ... bench: 17 ns/iter (+/- 3) +test check_bits_func ... bench: 22 ns/iter (+/- 4) // using filter_map +test check_hash_filtermap ... bench: 970 ns/iter (+/- 216) // using filter_map +test check_bits_func_filter_map ... bench: 37 ns/iter (+/- 7) // using filter, then map +test check_hash_unicode ... bench: 1,052 ns/iter (+/- 327) ``` The `HashSet` approach was also benchmarked using [`filter_map`][filter-map] instead of `filter` and `map`. diff --git a/exercises/practice/isogram/.articles/performance/snippet.md b/exercises/practice/isogram/.articles/performance/snippet.md index 818e88b2d..397764ef9 100644 --- a/exercises/practice/isogram/.articles/performance/snippet.md +++ b/exercises/practice/isogram/.articles/performance/snippet.md @@ -1,8 +1,8 @@ ``` -test test_check_hash ... bench: 952 ns/iter (+/- 176) -test test_check_bits ... bench: 17 ns/iter (+/- 3) -test test_check_bits_func ... bench: 22 ns/iter (+/- 4) -test test_check_hash_filtermap ... bench: 970 ns/iter (+/- 216) -test test_check_bits_func_filter_map ... bench: 37 ns/iter (+/- 7) -test test_check_hash_unicode ... bench: 1,052 ns/iter (+/- 327) +test check_hash ... bench: 952 ns/iter (+/- 176) +test check_bits ... bench: 17 ns/iter (+/- 3) +test check_bits_func ... bench: 22 ns/iter (+/- 4) +test check_hash_filtermap ... bench: 970 ns/iter (+/- 216) +test check_bits_func_filter_map ... bench: 37 ns/iter (+/- 7) +test check_hash_unicode ... bench: 1,052 ns/iter (+/- 327) ``` diff --git a/exercises/practice/kindergarten-garden/tests/kindergarten-garden.rs b/exercises/practice/kindergarten-garden/tests/kindergarten-garden.rs index 054d5c72e..644b29cd7 100644 --- a/exercises/practice/kindergarten-garden/tests/kindergarten-garden.rs +++ b/exercises/practice/kindergarten-garden/tests/kindergarten-garden.rs @@ -1,7 +1,7 @@ use kindergarten_garden::*; #[test] -fn test_garden_with_single_student() { +fn garden_with_single_student() { let diagram = "RC GG"; let student = "Alice"; @@ -11,7 +11,7 @@ GG"; #[test] #[ignore] -fn test_different_garden_with_single_student() { +fn different_garden_with_single_student() { let diagram = "VC RC"; let student = "Alice"; @@ -21,7 +21,7 @@ RC"; #[test] #[ignore] -fn test_garden_with_two_students() { +fn garden_with_two_students() { let diagram = "VVCG VVRC"; let student = "Bob"; @@ -31,7 +31,7 @@ VVRC"; #[test] #[ignore] -fn test_second_students_garden() { +fn second_students_garden() { let diagram = "VVCCGG VVCCGG"; let student = "Bob"; @@ -41,7 +41,7 @@ VVCCGG"; #[test] #[ignore] -fn test_third_students_garden() { +fn third_students_garden() { let diagram = "VVCCGG VVCCGG"; let student = "Charlie"; @@ -51,7 +51,7 @@ VVCCGG"; #[test] #[ignore] -fn test_for_alice_first_students_garden() { +fn for_alice_first_students_garden() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Alice"; @@ -61,7 +61,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_bob_second_students_garden() { +fn for_bob_second_students_garden() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Bob"; @@ -71,7 +71,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_charlie() { +fn for_charlie() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Charlie"; @@ -81,7 +81,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_david() { +fn for_david() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "David"; @@ -91,7 +91,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_eve() { +fn for_eve() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Eve"; @@ -101,7 +101,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_fred() { +fn for_fred() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Fred"; @@ -111,7 +111,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_ginny() { +fn for_ginny() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Ginny"; @@ -121,7 +121,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_harriet() { +fn for_harriet() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Harriet"; @@ -131,7 +131,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_ileana() { +fn for_ileana() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Ileana"; @@ -141,7 +141,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_joseph() { +fn for_joseph() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Joseph"; @@ -151,7 +151,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_kincaid_second_to_last_students_garden() { +fn for_kincaid_second_to_last_students_garden() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Kincaid"; @@ -161,7 +161,7 @@ VRCCCGCRRGVCGCRVVCVGCGCV"; #[test] #[ignore] -fn test_for_larry_last_students_garden() { +fn for_larry_last_students_garden() { let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV"; let student = "Larry"; diff --git a/exercises/practice/knapsack/tests/knapsack.rs b/exercises/practice/knapsack/tests/knapsack.rs index b351715bd..05b1b9b51 100644 --- a/exercises/practice/knapsack/tests/knapsack.rs +++ b/exercises/practice/knapsack/tests/knapsack.rs @@ -1,7 +1,7 @@ use knapsack::*; #[test] -fn test_example_knapsack() { +fn example_knapsack() { let max_weight = 10; let items = [ Item { @@ -27,7 +27,7 @@ fn test_example_knapsack() { #[test] #[ignore] -fn test_no_items() { +fn no_items() { let max_weight = 100; let items = []; @@ -36,7 +36,7 @@ fn test_no_items() { #[test] #[ignore] -fn test_one_item_too_heavy() { +fn one_item_too_heavy() { let max_weight = 10; let items = [Item { weight: 100, @@ -48,7 +48,7 @@ fn test_one_item_too_heavy() { #[test] #[ignore] -fn test_five_items_cannot_be_greedy_by_weight() { +fn five_items_cannot_be_greedy_by_weight() { let max_weight = 10; let items = [ Item { @@ -78,7 +78,7 @@ fn test_five_items_cannot_be_greedy_by_weight() { #[test] #[ignore] -fn test_five_items_cannot_be_greedy_by_value() { +fn five_items_cannot_be_greedy_by_value() { let max_weight = 10; let items = [ Item { @@ -108,7 +108,7 @@ fn test_five_items_cannot_be_greedy_by_value() { #[test] #[ignore] -fn test_8_items() { +fn eight_items() { let max_weight = 104; let items = [ Item { @@ -150,7 +150,7 @@ fn test_8_items() { #[test] #[ignore] -fn test_15_items() { +fn fifteen_items() { let max_weight = 750; let items = [ Item { diff --git a/exercises/practice/leap/.articles/performance/code/main.rs b/exercises/practice/leap/.articles/performance/code/main.rs index c1628cf4f..4ed266f5a 100644 --- a/exercises/practice/leap/.articles/performance/code/main.rs +++ b/exercises/practice/leap/.articles/performance/code/main.rs @@ -46,31 +46,31 @@ pub fn is_leap_year_naive(year: u64) -> bool { } #[bench] -fn test_ternary(b: &mut Bencher) { +fn ternary(b: &mut Bencher) { b.iter(|| is_leap_year(2000)); } #[bench] -fn test_one_line(b: &mut Bencher) { +fn one_line(b: &mut Bencher) { b.iter(|| is_leap_year_one_line(2000)); } #[bench] -fn test_match(b: &mut Bencher) { +fn match(b: &mut Bencher) { b.iter(|| is_leap_year_match(2000)); } #[bench] -fn test_time(b: &mut Bencher) { +fn time(b: &mut Bencher) { b.iter(|| is_leap_year_time(2000)); } #[bench] -fn test_chrono(b: &mut Bencher) { +fn chrono(b: &mut Bencher) { b.iter(|| is_leap_year_chrono(2000)); } #[bench] -fn test_naive(b: &mut Bencher) { +fn naive(b: &mut Bencher) { b.iter(|| is_leap_year_naive(2000)); } diff --git a/exercises/practice/leap/.articles/performance/content.md b/exercises/practice/leap/.articles/performance/content.md index 2edb23c34..53b79f4ff 100644 --- a/exercises/practice/leap/.articles/performance/content.md +++ b/exercises/practice/leap/.articles/performance/content.md @@ -18,12 +18,12 @@ For our performance investigation, we'll also include two other approaches: To benchmark the approaches, we wrote a [small benchmark application][benchmark-application]. ``` -test test_ternary ... bench: 0 ns/iter (+/- 0) -test test_one_line ... bench: 0 ns/iter (+/- 0) -test test_match ... bench: 0 ns/iter (+/- 0) -test test_time ... bench: 30 ns/iter (+/- 9) -test test_chrono ... bench: 18 ns/iter (+/- 3) -test test_naive ... bench: 18 ns/iter (+/- 1) +test ternary ... bench: 0 ns/iter (+/- 0) +test one_line ... bench: 0 ns/iter (+/- 0) +test match ... bench: 0 ns/iter (+/- 0) +test time ... bench: 30 ns/iter (+/- 9) +test chrono ... bench: 18 ns/iter (+/- 3) +test naive ... bench: 18 ns/iter (+/- 1) ``` The three main approaches were identical in measurable performance. diff --git a/exercises/practice/leap/.articles/performance/snippet.md b/exercises/practice/leap/.articles/performance/snippet.md index de3e4d3c8..ddb5f0085 100644 --- a/exercises/practice/leap/.articles/performance/snippet.md +++ b/exercises/practice/leap/.articles/performance/snippet.md @@ -1,7 +1,7 @@ ``` -test test_ternary ... bench: 0 ns/iter (+/- 0) -test test_one_line ... bench: 0 ns/iter (+/- 0) -test test_match ... bench: 0 ns/iter (+/- 0) -test test_time ... bench: 30 ns/iter (+/- 9) -test test_chrono ... bench: 19 ns/iter (+/- 1) +test ternary ... bench: 0 ns/iter (+/- 0) +test one_line ... bench: 0 ns/iter (+/- 0) +test match ... bench: 0 ns/iter (+/- 0) +test time ... bench: 30 ns/iter (+/- 9) +test chrono ... bench: 19 ns/iter (+/- 1) ``` diff --git a/exercises/practice/leap/tests/leap.rs b/exercises/practice/leap/tests/leap.rs index 4c7ee2ce6..88b5cae7f 100644 --- a/exercises/practice/leap/tests/leap.rs +++ b/exercises/practice/leap/tests/leap.rs @@ -3,67 +3,67 @@ fn process_leapyear_case(year: u64, expected: bool) { } #[test] -fn test_year_not_divisible_by_4_common_year() { +fn year_not_divisible_by_4_common_year() { process_leapyear_case(2015, false); } #[test] #[ignore] -fn test_year_divisible_by_2_not_divisible_by_4_in_common_year() { +fn year_divisible_by_2_not_divisible_by_4_in_common_year() { process_leapyear_case(1970, false); } #[test] #[ignore] -fn test_year_divisible_by_4_not_divisible_by_100_leap_year() { +fn year_divisible_by_4_not_divisible_by_100_leap_year() { process_leapyear_case(1996, true); } #[test] #[ignore] -fn test_year_divisible_by_4_and_5_is_still_a_leap_year() { +fn year_divisible_by_4_and_5_is_still_a_leap_year() { process_leapyear_case(1960, true); } #[test] #[ignore] -fn test_year_divisible_by_100_not_divisible_by_400_common_year() { +fn year_divisible_by_100_not_divisible_by_400_common_year() { process_leapyear_case(2100, false); } #[test] #[ignore] -fn test_year_divisible_by_100_but_not_by_3_is_still_not_a_leap_year() { +fn year_divisible_by_100_but_not_by_3_is_still_not_a_leap_year() { process_leapyear_case(1900, false); } #[test] #[ignore] -fn test_year_divisible_by_400_leap_year() { +fn year_divisible_by_400_leap_year() { process_leapyear_case(2000, true); } #[test] #[ignore] -fn test_year_divisible_by_400_but_not_by_125_is_still_a_leap_year() { +fn year_divisible_by_400_but_not_by_125_is_still_a_leap_year() { process_leapyear_case(2400, true); } #[test] #[ignore] -fn test_year_divisible_by_200_not_divisible_by_400_common_year() { +fn year_divisible_by_200_not_divisible_by_400_common_year() { process_leapyear_case(1800, false); } #[test] #[ignore] -fn test_any_old_year() { +fn any_old_year() { process_leapyear_case(1997, false); } #[test] #[ignore] -fn test_early_years() { +fn early_years() { process_leapyear_case(1, false); process_leapyear_case(4, true); process_leapyear_case(100, false); @@ -73,7 +73,7 @@ fn test_early_years() { #[test] #[ignore] -fn test_century() { +fn century() { process_leapyear_case(1700, false); process_leapyear_case(1800, false); process_leapyear_case(1900, false); @@ -81,7 +81,7 @@ fn test_century() { #[test] #[ignore] -fn test_exceptional_centuries() { +fn exceptional_centuries() { process_leapyear_case(1600, true); process_leapyear_case(2000, true); process_leapyear_case(2400, true); @@ -89,7 +89,7 @@ fn test_exceptional_centuries() { #[test] #[ignore] -fn test_years_1600_to_1699() { +fn years_1600_to_1699() { let incorrect_years = (1600..1700) .filter(|&year| leap::is_leap_year(year) != (year % 4 == 0)) .collect::>(); diff --git a/exercises/practice/luhn-from/tests/luhn-from.rs b/exercises/practice/luhn-from/tests/luhn-from.rs index a94e16da4..b5f42b3d9 100644 --- a/exercises/practice/luhn-from/tests/luhn-from.rs +++ b/exercises/practice/luhn-from/tests/luhn-from.rs @@ -100,6 +100,6 @@ fn strings_that_contain_non_digits_are_invalid() { #[test] #[ignore] -fn test_input_digit_9_is_still_correctly_converted_to_output_digit_9() { +fn input_digit_9_is_still_correctly_converted_to_output_digit_9() { assert!(Luhn::from("091").is_valid()); } diff --git a/exercises/practice/luhn-trait/tests/luhn-trait.rs b/exercises/practice/luhn-trait/tests/luhn-trait.rs index bc5bd9cc4..dd0454c17 100644 --- a/exercises/practice/luhn-trait/tests/luhn-trait.rs +++ b/exercises/practice/luhn-trait/tests/luhn-trait.rs @@ -58,6 +58,6 @@ fn you_can_validate_from_a_usize() { #[test] #[ignore] -fn test_input_digit_9_is_still_correctly_converted_to_output_digit_9() { +fn input_digit_9_is_still_correctly_converted_to_output_digit_9() { assert!("091".valid_luhn()); } diff --git a/exercises/practice/luhn/tests/luhn.rs b/exercises/practice/luhn/tests/luhn.rs index 1eab9c40f..c2ce6839b 100644 --- a/exercises/practice/luhn/tests/luhn.rs +++ b/exercises/practice/luhn/tests/luhn.rs @@ -5,49 +5,49 @@ fn process_valid_case(number: &str, is_luhn_expected: bool) { } #[test] -fn test_single_digit_strings_can_not_be_valid() { +fn single_digit_strings_can_not_be_valid() { process_valid_case("1", false); } #[test] #[ignore] -fn test_a_single_zero_is_invalid() { +fn a_single_zero_is_invalid() { process_valid_case("0", false); } #[test] #[ignore] -fn test_a_simple_valid_sin_that_remains_valid_if_reversed() { +fn a_simple_valid_sin_that_remains_valid_if_reversed() { process_valid_case("059", true); } #[test] #[ignore] -fn test_a_simple_valid_sin_that_becomes_invalid_if_reversed() { +fn a_simple_valid_sin_that_becomes_invalid_if_reversed() { process_valid_case("59", true); } #[test] #[ignore] -fn test_a_valid_canadian_sin() { +fn a_valid_canadian_sin() { process_valid_case("055 444 285", true); } #[test] #[ignore] -fn test_invalid_canadian_sin() { +fn invalid_canadian_sin() { process_valid_case("055 444 286", false); } #[test] #[ignore] -fn test_invalid_credit_card() { +fn invalid_credit_card() { process_valid_case("8273 1232 7352 0569", false); } #[test] #[ignore] -fn test_valid_number_with_an_even_number_of_digits() { +fn valid_number_with_an_even_number_of_digits() { process_valid_case("095 245 88", true); } @@ -59,7 +59,7 @@ fn strings_that_contain_non_digits_are_invalid() { #[test] #[ignore] -fn test_valid_strings_with_punctuation_included_become_invalid() { +fn valid_strings_with_punctuation_included_become_invalid() { process_valid_case("055-444-285", false); } @@ -71,19 +71,19 @@ fn symbols_are_invalid() { #[test] #[ignore] -fn test_single_zero_with_space_is_invalid() { +fn single_zero_with_space_is_invalid() { process_valid_case(" 0", false); } #[test] #[ignore] -fn test_more_than_a_single_zero_is_valid() { +fn more_than_a_single_zero_is_valid() { process_valid_case("0000 0", true); } #[test] #[ignore] -fn test_input_digit_9_is_correctly_converted_to_output_digit_9() { +fn input_digit_9_is_correctly_converted_to_output_digit_9() { process_valid_case("091", true); } @@ -92,21 +92,21 @@ fn test_input_digit_9_is_correctly_converted_to_output_digit_9() { /// using ASCII value for doubled non-digit isn't allowed /// Convert non-digits to their ASCII values and then offset them by 48 sometimes accidentally declare an invalid string to be valid. /// This test is designed to avoid that solution. -fn test_using_ascii_value_for_doubled_nondigit_isnt_allowed() { +fn using_ascii_value_for_doubled_nondigit_isnt_allowed() { process_valid_case(":9", false); } #[test] #[ignore] /// valid strings with a non-digit added at the end become invalid -fn test_valid_strings_with_a_nondigit_added_at_the_end_become_invalid() { +fn valid_strings_with_a_nondigit_added_at_the_end_become_invalid() { process_valid_case("059a", false); } #[test] #[ignore] /// valid strings with symbols included become invalid -fn test_valid_strings_with_symbols_included_become_invalid() { +fn valid_strings_with_symbols_included_become_invalid() { process_valid_case("055# 444$ 285", false); } @@ -115,27 +115,27 @@ fn test_valid_strings_with_symbols_included_become_invalid() { /// using ASCII value for non-doubled non-digit isn't allowed /// Convert non-digits to their ASCII values and then offset them by 48 sometimes accidentally declare an invalid string to be valid. /// This test is designed to avoid that solution. -fn test_using_ascii_value_for_nondoubled_nondigit_isnt_allowed() { +fn using_ascii_value_for_nondoubled_nondigit_isnt_allowed() { process_valid_case("055b 444 285", false); } #[test] #[ignore] /// valid number with an odd number of spaces -fn test_valid_number_with_an_odd_number_of_spaces() { +fn valid_number_with_an_odd_number_of_spaces() { process_valid_case("234 567 891 234", true); } #[test] #[ignore] /// non-numeric, non-space char in the middle with a sum that's divisible by 10 isn't allowed -fn test_invalid_char_in_middle_with_sum_divisible_by_10_isnt_allowed() { +fn invalid_char_in_middle_with_sum_divisible_by_10_isnt_allowed() { process_valid_case("59%59", false); } #[test] #[ignore] /// unicode numeric characters are not allowed in a otherwise valid number -fn test_valid_strings_with_numeric_unicode_characters_become_invalid() { +fn valid_strings_with_numeric_unicode_characters_become_invalid() { process_valid_case("1249①", false); } diff --git a/exercises/practice/macros/tests/macros.rs b/exercises/practice/macros/tests/macros.rs index b546174f2..8e212399a 100644 --- a/exercises/practice/macros/tests/macros.rs +++ b/exercises/practice/macros/tests/macros.rs @@ -2,7 +2,7 @@ use macros::hashmap; use std::collections::HashMap; #[test] -fn test_empty() { +fn empty() { let expected: HashMap = HashMap::new(); let computed: HashMap = hashmap!(); assert_eq!(computed, expected); @@ -10,7 +10,7 @@ fn test_empty() { #[test] #[ignore] -fn test_single() { +fn single() { let mut expected = HashMap::new(); expected.insert(1, "one"); assert_eq!(hashmap!(1 => "one"), expected); @@ -18,7 +18,7 @@ fn test_single() { #[test] #[ignore] -fn test_no_trailing_comma() { +fn no_trailing_comma() { let mut expected = HashMap::new(); expected.insert(1, "one"); expected.insert(2, "two"); @@ -27,7 +27,7 @@ fn test_no_trailing_comma() { #[test] #[ignore] -fn test_trailing_comma() { +fn trailing_comma() { let mut expected = HashMap::new(); expected.insert('h', 89); expected.insert('a', 1); @@ -46,7 +46,7 @@ fn test_trailing_comma() { #[test] #[ignore] -fn test_nested() { +fn nested() { let mut expected = HashMap::new(); expected.insert("non-empty", { let mut subhashmap = HashMap::new(); @@ -80,7 +80,7 @@ mod test { #[test] #[ignore] - fn test_macro_out_of_scope() { + fn macro_out_of_scope() { let _empty: ::std::collections::HashMap<(), ()> = macros::hashmap!(); let _without_comma = macros::hashmap!(23=> 623, 34 => 21); let _with_trailing = macros::hashmap!(23 => 623, 34 => 21,); @@ -89,7 +89,7 @@ mod test { #[test] #[ignore] -fn test_type_override() { +fn type_override() { // The macro should always use std::collections::HashMap and ignore crate::std::collections::HashMap mod std { pub mod collections { @@ -116,61 +116,61 @@ fn test_type_override() { #[test] #[ignore] -fn test_compile_fails_comma_sep() { +fn compile_fails_comma_sep() { simple_trybuild::compile_fail("comma-sep.rs"); } #[test] #[ignore] -fn test_compile_fails_double_commas() { +fn compile_fails_double_commas() { simple_trybuild::compile_fail("double-commas.rs"); } #[test] #[ignore] -fn test_compile_fails_only_comma() { +fn compile_fails_only_comma() { simple_trybuild::compile_fail("only-comma.rs"); } #[test] #[ignore] -fn test_compile_fails_single_argument() { +fn compile_fails_single_argument() { simple_trybuild::compile_fail("single-argument.rs"); } #[test] #[ignore] -fn test_compile_fails_triple_arguments() { +fn compile_fails_triple_arguments() { simple_trybuild::compile_fail("triple-arguments.rs"); } #[test] #[ignore] -fn test_compile_fails_only_arrow() { +fn compile_fails_only_arrow() { simple_trybuild::compile_fail("only-arrow.rs"); } #[test] #[ignore] -fn test_compile_fails_two_arrows() { +fn compile_fails_two_arrows() { simple_trybuild::compile_fail("two-arrows.rs"); } #[test] #[ignore] -fn test_compile_fails_leading_comma() { +fn compile_fails_leading_comma() { simple_trybuild::compile_fail("leading-comma.rs"); } #[test] #[ignore] -fn test_compile_fails_no_comma() { +fn compile_fails_no_comma() { simple_trybuild::compile_fail("no-comma.rs"); } #[test] #[ignore] -fn test_compile_fails_missing_argument() { +fn compile_fails_missing_argument() { simple_trybuild::compile_fail("missing-argument.rs"); } diff --git a/exercises/practice/nth-prime/tests/nth-prime.rs b/exercises/practice/nth-prime/tests/nth-prime.rs index 7b8c17e91..c9dfd371a 100644 --- a/exercises/practice/nth-prime/tests/nth-prime.rs +++ b/exercises/practice/nth-prime/tests/nth-prime.rs @@ -1,24 +1,24 @@ use nth_prime as np; #[test] -fn test_first_prime() { +fn first_prime() { assert_eq!(np::nth(0), 2); } #[test] #[ignore] -fn test_second_prime() { +fn second_prime() { assert_eq!(np::nth(1), 3); } #[test] #[ignore] -fn test_sixth_prime() { +fn sixth_prime() { assert_eq!(np::nth(5), 13); } #[test] #[ignore] -fn test_big_prime() { +fn big_prime() { assert_eq!(np::nth(10_000), 104_743); } diff --git a/exercises/practice/nucleotide-codons/tests/nucleotide-codons.rs b/exercises/practice/nucleotide-codons/tests/nucleotide-codons.rs index f585d57e2..bee25bb69 100644 --- a/exercises/practice/nucleotide-codons/tests/nucleotide-codons.rs +++ b/exercises/practice/nucleotide-codons/tests/nucleotide-codons.rs @@ -1,19 +1,19 @@ #[test] -fn test_methionine() { +fn methionine() { let info = nucleotide_codons::parse(make_pairs()); assert_eq!(info.name_for("ATG"), Ok("methionine")); } #[test] #[ignore] -fn test_cysteine_tgt() { +fn cysteine_tgt() { let info = nucleotide_codons::parse(make_pairs()); assert_eq!(info.name_for("TGT"), Ok("cysteine")); } #[test] #[ignore] -fn test_cysteine_tgy() { +fn cysteine_tgy() { // "compressed" name for TGT and TGC let info = nucleotide_codons::parse(make_pairs()); assert_eq!(info.name_for("TGT"), info.name_for("TGY")); @@ -22,28 +22,28 @@ fn test_cysteine_tgy() { #[test] #[ignore] -fn test_stop() { +fn stop() { let info = nucleotide_codons::parse(make_pairs()); assert_eq!(info.name_for("TAA"), Ok("stop codon")); } #[test] #[ignore] -fn test_valine() { +fn valine() { let info = nucleotide_codons::parse(make_pairs()); assert_eq!(info.name_for("GTN"), Ok("valine")); } #[test] #[ignore] -fn test_isoleucine() { +fn isoleucine() { let info = nucleotide_codons::parse(make_pairs()); assert_eq!(info.name_for("ATH"), Ok("isoleucine")); } #[test] #[ignore] -fn test_arginine_name() { +fn arginine_name() { // In arginine CGA can be "compressed" both as CGN and as MGR let info = nucleotide_codons::parse(make_pairs()); assert_eq!(info.name_for("CGA"), Ok("arginine")); diff --git a/exercises/practice/nucleotide-count/tests/nucleotide-count.rs b/exercises/practice/nucleotide-count/tests/nucleotide-count.rs index e910798ad..83b3bf5e2 100644 --- a/exercises/practice/nucleotide-count/tests/nucleotide-count.rs +++ b/exercises/practice/nucleotide-count/tests/nucleotide-count.rs @@ -23,7 +23,7 @@ fn count_returns_result() { #[test] #[ignore] -fn test_count_empty() { +fn count_empty() { assert_eq!(dna::count('A', ""), Ok(0)); } @@ -41,13 +41,13 @@ fn count_invalid_dna() { #[test] #[ignore] -fn test_count_repetitive_cytosine() { +fn count_repetitive_cytosine() { assert_eq!(dna::count('C', "CCCCC"), Ok(5)); } #[test] #[ignore] -fn test_count_only_thymine() { +fn count_only_thymine() { assert_eq!(dna::count('T', "GGGGGTAACCCGG"), Ok(1)); } @@ -59,27 +59,27 @@ fn counts_returns_result() { #[test] #[ignore] -fn test_empty_strand() { +fn empty_strand() { process_nucleotidecounts_case("", &[('A', 0), ('T', 0), ('C', 0), ('G', 0)]); } #[test] #[ignore] /// can count one nucleotide in single-character input -fn test_can_count_one_nucleotide_in_singlecharacter_input() { +fn can_count_one_nucleotide_in_singlecharacter_input() { process_nucleotidecounts_case("G", &[('A', 0), ('C', 0), ('G', 1), ('T', 0)]); } #[test] #[ignore] -fn test_strand_with_repeated_nucleotide() { +fn strand_with_repeated_nucleotide() { process_nucleotidecounts_case("GGGGGGG", &[('A', 0), ('T', 0), ('C', 0), ('G', 7)]); } #[test] #[ignore] /// strand with multiple nucleotides -fn test_strand_with_multiple_nucleotides() { +fn strand_with_multiple_nucleotides() { process_nucleotidecounts_case( "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC", &[('A', 20), ('T', 21), ('C', 12), ('G', 17)], @@ -95,6 +95,6 @@ fn counts_invalid_nucleotide_results_in_err() { #[test] #[ignore] /// strand with invalid nucleotides -fn test_strand_with_invalid_nucleotides() { +fn strand_with_invalid_nucleotides() { assert_eq!(dna::nucleotide_counts("AGXXACT"), Err('X'),); } diff --git a/exercises/practice/paasio/tests/paasio.rs b/exercises/practice/paasio/tests/paasio.rs index 59fdb9999..9079691cb 100644 --- a/exercises/practice/paasio/tests/paasio.rs +++ b/exercises/practice/paasio/tests/paasio.rs @@ -9,7 +9,7 @@ macro_rules! test_read { $(#[$attr])* #[test] - fn test_read_passthrough() { + fn read_passthrough() { let data = $input; let len = $len; let size = len(&data); @@ -30,7 +30,7 @@ macro_rules! test_read { $(#[$attr])* #[test] - fn test_read_chunks() { + fn read_chunks() { let data = $input; let len = $len; let size = len(&data); @@ -51,7 +51,7 @@ macro_rules! test_read { $(#[$attr])* #[test] - fn test_read_buffered_chunks() { + fn read_buffered_chunks() { let data = $input; let len = $len; let size = len(&data); @@ -85,7 +85,7 @@ macro_rules! test_write { const CHUNK_SIZE: usize = 2; $(#[$attr])* #[test] - fn test_write_passthrough() { + fn write_passthrough() { let data = $input; let len = $len; let size = len(&data); @@ -100,7 +100,7 @@ macro_rules! test_write { $(#[$attr])* #[test] - fn test_sink_oneshot() { + fn sink_oneshot() { let data = $input; let len = $len; let size = len(&data); @@ -114,7 +114,7 @@ macro_rules! test_write { $(#[$attr])* #[test] - fn test_sink_windowed() { + fn sink_windowed() { let data = $input; let len = $len; let size = len(&data); @@ -133,7 +133,7 @@ macro_rules! test_write { $(#[$attr])* #[test] - fn test_sink_buffered_windowed() { + fn sink_buffered_windowed() { let data = $input; let len = $len; let size = len(&data); @@ -159,7 +159,7 @@ macro_rules! test_write { } #[test] -fn test_create_stats() { +fn create_stats() { let mut data: Vec = Vec::new(); let _ = paasio::ReadStats::new(data.as_slice()); let _ = paasio::WriteStats::new(data.as_mut_slice()); diff --git a/exercises/practice/palindrome-products/tests/palindrome-products.rs b/exercises/practice/palindrome-products/tests/palindrome-products.rs index b3a32f0ad..de3deb702 100644 --- a/exercises/practice/palindrome-products/tests/palindrome-products.rs +++ b/exercises/practice/palindrome-products/tests/palindrome-products.rs @@ -23,7 +23,7 @@ fn process_largest_case((from, to): (u64, u64), expected: Option) { #[test] /// test `Palindrome::new` with valid input -fn test_palindrome_new_return_some() { +fn palindrome_new_return_some() { for v in [1, 11, 121, 12321, 1234321, 123454321, 543212345] { assert_eq!(Palindrome::new(v).expect("is a palindrome").into_inner(), v); } @@ -32,7 +32,7 @@ fn test_palindrome_new_return_some() { #[test] #[ignore] /// test `Palindrome::new` with invalid input -fn test_palindrome_new_return_none() { +fn palindrome_new_return_none() { for v in [12, 2322, 23443, 1233211, 8932343] { assert_eq!(Palindrome::new(v), None); } @@ -41,83 +41,83 @@ fn test_palindrome_new_return_none() { #[test] #[ignore] /// finds the smallest palindrome from single digit factors -fn test_finds_the_smallest_palindrome_from_single_digit_factors() { +fn finds_the_smallest_palindrome_from_single_digit_factors() { process_smallest_case((1, 9), Some(1)); } #[test] #[ignore] /// finds the largest palindrome from single digit factors -fn test_finds_the_largest_palindrome_from_single_digit_factors() { +fn finds_the_largest_palindrome_from_single_digit_factors() { process_largest_case((1, 9), Some(9)); } #[test] #[ignore] /// find the smallest palindrome from double digit factors -fn test_find_the_smallest_palindrome_from_double_digit_factors() { +fn find_the_smallest_palindrome_from_double_digit_factors() { process_smallest_case((10, 99), Some(121)); } #[test] #[ignore] /// find the largest palindrome from double digit factors -fn test_find_the_largest_palindrome_from_double_digit_factors() { +fn find_the_largest_palindrome_from_double_digit_factors() { process_largest_case((10, 99), Some(9009)); } #[test] #[ignore] /// find smallest palindrome from triple digit factors -fn test_find_smallest_palindrome_from_triple_digit_factors() { +fn find_smallest_palindrome_from_triple_digit_factors() { process_smallest_case((100, 999), Some(10201)); } #[test] #[ignore] /// find the largest palindrome from triple digit factors -fn test_find_the_largest_palindrome_from_triple_digit_factors() { +fn find_the_largest_palindrome_from_triple_digit_factors() { process_largest_case((100, 999), Some(906609)); } #[test] #[ignore] /// find smallest palindrome from four digit factors -fn test_find_smallest_palindrome_from_four_digit_factors() { +fn find_smallest_palindrome_from_four_digit_factors() { process_smallest_case((1000, 9999), Some(1002001)); } #[test] #[ignore] /// find the largest palindrome from four digit factors -fn test_find_the_largest_palindrome_from_four_digit_factors() { +fn find_the_largest_palindrome_from_four_digit_factors() { process_largest_case((1000, 9999), Some(99000099)); } #[test] #[ignore] /// empty result for smallest if no palindrome in the range -fn test_empty_result_for_smallest_if_no_palindrome_in_the_range() { +fn empty_result_for_smallest_if_no_palindrome_in_the_range() { process_smallest_case((1002, 1003), None); } #[test] #[ignore] /// empty result for largest if no palindrome in the range -fn test_empty_result_for_largest_if_no_palindrome_in_the_range() { +fn empty_result_for_largest_if_no_palindrome_in_the_range() { process_largest_case((15, 15), None); } #[test] #[ignore] /// error result for smallest if min is more than max -fn test_error_result_for_smallest_if_min_is_more_than_max() { +fn error_result_for_smallest_if_min_is_more_than_max() { process_smallest_case((10000, 1), None); } #[test] #[ignore] /// error result for largest if min is more than max -fn test_error_result_for_largest_if_min_is_more_than_max() { +fn error_result_for_largest_if_min_is_more_than_max() { process_largest_case((2, 1), None); } diff --git a/exercises/practice/pangram/.articles/performance/code/main.rs b/exercises/practice/pangram/.articles/performance/code/main.rs index f56c3ce21..fadcc667d 100644 --- a/exercises/practice/pangram/.articles/performance/code/main.rs +++ b/exercises/practice/pangram/.articles/performance/code/main.rs @@ -47,7 +47,7 @@ pub fn is_pangram_bitfield(sentence: &str) -> bool { } #[bench] -fn test_is_pangram_all_contains(b: &mut Bencher) { +fn is_pangram_all_contains(b: &mut Bencher) { b.iter(|| { is_pangram_all_contains( "Victor jagt zwölf_(12) Boxkämpfer quer über den großen Sylter Deich.", @@ -56,7 +56,7 @@ fn test_is_pangram_all_contains(b: &mut Bencher) { } #[bench] -fn test_is_pangram_hash_is_subset(b: &mut Bencher) { +fn is_pangram_hash_is_subset(b: &mut Bencher) { b.iter(|| { is_pangram_hash_is_subset( "Victor jagt zwölf_(12) Boxkämpfer quer über den großen Sylter Deich.", @@ -65,7 +65,7 @@ fn test_is_pangram_hash_is_subset(b: &mut Bencher) { } #[bench] -fn test_is_pangram_hashset_len(b: &mut Bencher) { +fn is_pangram_hashset_len(b: &mut Bencher) { b.iter(|| { is_pangram_hashset_len( "Victor jagt zwölf_(12) Boxkämpfer quer über den großen Sylter Deich.", @@ -74,7 +74,7 @@ fn test_is_pangram_hashset_len(b: &mut Bencher) { } #[bench] -fn test_is_pangram_bitfield(b: &mut Bencher) { +fn is_pangram_bitfield(b: &mut Bencher) { b.iter(|| { is_pangram_bitfield("Victor jagt zwölf_(12) Boxkämpfer quer über den großen Sylter Deich.") }); diff --git a/exercises/practice/pangram/.articles/performance/content.md b/exercises/practice/pangram/.articles/performance/content.md index a13b56d55..e1ba60bbe 100644 --- a/exercises/practice/pangram/.articles/performance/content.md +++ b/exercises/practice/pangram/.articles/performance/content.md @@ -14,10 +14,10 @@ The [approaches page][approaches] lists four idiomatic approaches to this exerc To benchmark the approaches, we wrote a [small benchmark application][benchmark-application]. ``` -test test_is_pangram_all_contains ... bench: 850 ns/iter (+/- 525) -test test_is_pangram_hash_is_subset ... bench: 3,113 ns/iter (+/- 188) -test test_is_pangram_hashset_len ... bench: 1,737 ns/iter (+/- 331) -test test_is_pangram_bitfield ... bench: 76 ns/iter (+/- 12) +test is_pangram_all_contains ... bench: 850 ns/iter (+/- 525) +test is_pangram_hash_is_subset ... bench: 3,113 ns/iter (+/- 188) +test is_pangram_hashset_len ... bench: 1,737 ns/iter (+/- 331) +test is_pangram_bitfield ... bench: 76 ns/iter (+/- 12) ``` - The `HashSet` `len` approach is not quite twice as fast as the `HashSet` `is_subset` approach. diff --git a/exercises/practice/pangram/.articles/performance/snippet.md b/exercises/practice/pangram/.articles/performance/snippet.md index c160dc70b..dc80ecfd8 100644 --- a/exercises/practice/pangram/.articles/performance/snippet.md +++ b/exercises/practice/pangram/.articles/performance/snippet.md @@ -1,6 +1,6 @@ ``` -test test_is_pangram_all_contains ... bench: 850 ns/iter (+/- 525) -test test_is_pangram_hash_is_subset ... bench: 3,113 ns/iter (+/- 188) -test test_is_pangram_hashset_len ... bench: 1,737 ns/iter (+/- 331) -test test_is_pangram_bitfield ... bench: 76 ns/iter (+/- 12) +test is_pangram_all_contains ... bench: 850 ns/iter (+/- 525) +test is_pangram_hash_is_subset ... bench: 3,113 ns/iter (+/- 188) +test is_pangram_hashset_len ... bench: 1,737 ns/iter (+/- 331) +test is_pangram_bitfield ... bench: 76 ns/iter (+/- 12) ``` diff --git a/exercises/practice/parallel-letter-frequency/tests/parallel-letter-frequency.rs b/exercises/practice/parallel-letter-frequency/tests/parallel-letter-frequency.rs index 8e79feab6..128b6c495 100644 --- a/exercises/practice/parallel-letter-frequency/tests/parallel-letter-frequency.rs +++ b/exercises/practice/parallel-letter-frequency/tests/parallel-letter-frequency.rs @@ -39,13 +39,13 @@ const STAR_SPANGLED_BANNER: [&str; 8] = [ ]; #[test] -fn test_no_texts() { +fn no_texts() { assert_eq!(frequency::frequency(&[], 4), HashMap::new()); } #[test] #[ignore] -fn test_one_letter() { +fn one_letter() { let mut hm = HashMap::new(); hm.insert('a', 1); assert_eq!(frequency::frequency(&["a"], 4), hm); @@ -53,7 +53,7 @@ fn test_one_letter() { #[test] #[ignore] -fn test_case_insensitivity() { +fn case_insensitivity() { let mut hm = HashMap::new(); hm.insert('a', 2); assert_eq!(frequency::frequency(&["aA"], 4), hm); @@ -61,14 +61,14 @@ fn test_case_insensitivity() { #[test] #[ignore] -fn test_many_empty_lines() { +fn many_empty_lines() { let v = vec![""; 1000]; assert_eq!(frequency::frequency(&v[..], 4), HashMap::new()); } #[test] #[ignore] -fn test_many_times_same_text() { +fn many_times_same_text() { let v = vec!["abc"; 1000]; let mut hm = HashMap::new(); hm.insert('a', 1000); @@ -79,19 +79,19 @@ fn test_many_times_same_text() { #[test] #[ignore] -fn test_punctuation_doesnt_count() { +fn punctuation_doesnt_count() { assert!(!frequency::frequency(&WILHELMUS, 4).contains_key(&',')); } #[test] #[ignore] -fn test_numbers_dont_count() { +fn numbers_dont_count() { assert!(!frequency::frequency(&["Testing, 1, 2, 3"], 4).contains_key(&'1')); } #[test] #[ignore] -fn test_all_three_anthems_1_worker() { +fn all_three_anthems_1_worker() { let mut v = Vec::new(); for anthem in [ODE_AN_DIE_FREUDE, WILHELMUS, STAR_SPANGLED_BANNER].iter() { for line in anthem.iter() { @@ -106,7 +106,7 @@ fn test_all_three_anthems_1_worker() { #[test] #[ignore] -fn test_all_three_anthems_3_workers() { +fn all_three_anthems_3_workers() { let mut v = Vec::new(); for anthem in [ODE_AN_DIE_FREUDE, WILHELMUS, STAR_SPANGLED_BANNER].iter() { for line in anthem.iter() { @@ -121,7 +121,7 @@ fn test_all_three_anthems_3_workers() { #[test] #[ignore] -fn test_non_integer_multiple_of_threads() { +fn non_integer_multiple_of_threads() { let v = vec!["abc"; 999]; let mut hm = HashMap::new(); hm.insert('a', 999); diff --git a/exercises/practice/phone-number/tests/phone-number.rs b/exercises/practice/phone-number/tests/phone-number.rs index 2bde594e2..61751c014 100644 --- a/exercises/practice/phone-number/tests/phone-number.rs +++ b/exercises/practice/phone-number/tests/phone-number.rs @@ -5,108 +5,108 @@ fn process_clean_case(number: &str, expected: Option<&str>) { } #[test] -fn test_cleans_the_number() { +fn cleans_the_number() { process_clean_case("(223) 456-7890", Some("2234567890")); } #[test] #[ignore] -fn test_cleans_numbers_with_dots() { +fn cleans_numbers_with_dots() { process_clean_case("223.456.7890", Some("2234567890")); } #[test] #[ignore] -fn test_cleans_numbers_with_multiple_spaces() { +fn cleans_numbers_with_multiple_spaces() { process_clean_case("223 456 7890 ", Some("2234567890")); } #[test] #[ignore] -fn test_invalid_when_9_digits() { +fn invalid_when_9_digits() { process_clean_case("123456789", None); } #[test] #[ignore] -fn test_invalid_when_11_digits_does_not_start_with_a_1() { +fn invalid_when_11_digits_does_not_start_with_a_1() { process_clean_case("22234567890", None); } #[test] #[ignore] -fn test_valid_when_11_digits_and_starting_with_1() { +fn valid_when_11_digits_and_starting_with_1() { process_clean_case("12234567890", Some("2234567890")); } #[test] #[ignore] -fn test_valid_when_11_digits_and_starting_with_1_even_with_punctuation() { +fn valid_when_11_digits_and_starting_with_1_even_with_punctuation() { process_clean_case("+1 (223) 456-7890", Some("2234567890")); } #[test] #[ignore] -fn test_invalid_when_more_than_11_digits() { +fn invalid_when_more_than_11_digits() { process_clean_case("321234567890", None); } #[test] #[ignore] -fn test_invalid_with_letters() { +fn invalid_with_letters() { process_clean_case("123-abc-7890", None); } #[test] #[ignore] -fn test_invalid_with_punctuations() { +fn invalid_with_punctuations() { process_clean_case("123-@:!-7890", None); } #[test] #[ignore] -fn test_invalid_if_area_code_starts_with_1_on_valid_11digit_number() { +fn invalid_if_area_code_starts_with_1_on_valid_11digit_number() { process_clean_case("1 (123) 456-7890", None); } #[test] #[ignore] -fn test_invalid_if_area_code_starts_with_0_on_valid_11digit_number() { +fn invalid_if_area_code_starts_with_0_on_valid_11digit_number() { process_clean_case("1 (023) 456-7890", None); } #[test] #[ignore] -fn test_invalid_if_area_code_starts_with_1() { +fn invalid_if_area_code_starts_with_1() { process_clean_case("(123) 456-7890", None); } #[test] #[ignore] -fn test_invalid_if_exchange_code_starts_with_1() { +fn invalid_if_exchange_code_starts_with_1() { process_clean_case("(223) 156-7890", None); } #[test] #[ignore] -fn test_invalid_if_exchange_code_starts_with_0() { +fn invalid_if_exchange_code_starts_with_0() { process_clean_case("(223) 056-7890", None); } #[test] #[ignore] -fn test_invalid_if_exchange_code_starts_with_1_on_valid_11digit_number() { +fn invalid_if_exchange_code_starts_with_1_on_valid_11digit_number() { process_clean_case("1 (223) 156-7890", None); } #[test] #[ignore] -fn test_invalid_if_exchange_code_starts_with_0_on_valid_11digit_number() { +fn invalid_if_exchange_code_starts_with_0_on_valid_11digit_number() { process_clean_case("1 (223) 056-7890", None); } #[test] #[ignore] -fn test_invalid_if_area_code_starts_with_0() { +fn invalid_if_area_code_starts_with_0() { process_clean_case("(023) 456-7890", None); } diff --git a/exercises/practice/pig-latin/tests/pig-latin.rs b/exercises/practice/pig-latin/tests/pig-latin.rs index 6e3812744..5ebd5e85d 100644 --- a/exercises/practice/pig-latin/tests/pig-latin.rs +++ b/exercises/practice/pig-latin/tests/pig-latin.rs @@ -1,126 +1,126 @@ use pig_latin as pl; #[test] -fn test_word_beginning_with_a() { +fn word_beginning_with_a() { assert_eq!(pl::translate("apple"), "appleay"); } #[test] #[ignore] -fn test_word_beginning_with_e() { +fn word_beginning_with_e() { assert_eq!(pl::translate("ear"), "earay"); } #[test] #[ignore] -fn test_word_beginning_with_i() { +fn word_beginning_with_i() { assert_eq!(pl::translate("igloo"), "iglooay"); } #[test] #[ignore] -fn test_word_beginning_with_o() { +fn word_beginning_with_o() { assert_eq!(pl::translate("object"), "objectay"); } #[test] #[ignore] -fn test_word_beginning_with_u() { +fn word_beginning_with_u() { assert_eq!(pl::translate("under"), "underay"); } #[test] #[ignore] -fn test_word_beginning_with_a_vowel_and_followed_by_a_qu() { +fn word_beginning_with_a_vowel_and_followed_by_a_qu() { assert_eq!(pl::translate("equal"), "equalay"); } #[test] #[ignore] -fn test_word_beginning_with_p() { +fn word_beginning_with_p() { assert_eq!(pl::translate("pig"), "igpay"); } #[test] #[ignore] -fn test_word_beginning_with_k() { +fn word_beginning_with_k() { assert_eq!(pl::translate("koala"), "oalakay"); } #[test] #[ignore] -fn test_word_beginning_with_y() { +fn word_beginning_with_y() { assert_eq!(pl::translate("yellow"), "ellowyay"); } #[test] #[ignore] -fn test_word_beginning_with_x() { +fn word_beginning_with_x() { assert_eq!(pl::translate("xenon"), "enonxay"); } #[test] #[ignore] -fn test_word_beginning_with_q_without_a_following_u() { +fn word_beginning_with_q_without_a_following_u() { assert_eq!(pl::translate("qat"), "atqay"); } #[test] #[ignore] -fn test_word_beginning_with_ch() { +fn word_beginning_with_ch() { assert_eq!(pl::translate("chair"), "airchay"); } #[test] #[ignore] -fn test_word_beginning_with_qu() { +fn word_beginning_with_qu() { assert_eq!(pl::translate("queen"), "eenquay"); } #[test] #[ignore] -fn test_word_beginning_with_qu_and_a_preceding_consonant() { +fn word_beginning_with_qu_and_a_preceding_consonant() { assert_eq!(pl::translate("square"), "aresquay"); } #[test] #[ignore] -fn test_word_beginning_with_th() { +fn word_beginning_with_th() { assert_eq!(pl::translate("therapy"), "erapythay"); } #[test] #[ignore] -fn test_word_beginning_with_thr() { +fn word_beginning_with_thr() { assert_eq!(pl::translate("thrush"), "ushthray"); } #[test] #[ignore] -fn test_word_beginning_with_sch() { +fn word_beginning_with_sch() { assert_eq!(pl::translate("school"), "oolschay"); } #[test] #[ignore] -fn test_word_beginning_with_yt() { +fn word_beginning_with_yt() { assert_eq!(pl::translate("yttria"), "yttriaay"); } #[test] #[ignore] -fn test_word_beginning_with_xr() { +fn word_beginning_with_xr() { assert_eq!(pl::translate("xray"), "xrayay"); } #[test] #[ignore] -fn test_y_is_treated_like_a_vowel_at_the_end_of_a_consonant_cluster() { +fn y_is_treated_like_a_vowel_at_the_end_of_a_consonant_cluster() { assert_eq!(pl::translate("rhythm"), "ythmrhay"); } #[test] #[ignore] -fn test_a_whole_phrase() { +fn a_whole_phrase() { assert_eq!(pl::translate("quick fast run"), "ickquay astfay unray"); } diff --git a/exercises/practice/poker/tests/poker.rs b/exercises/practice/poker/tests/poker.rs index cd16325f3..44ed780e6 100644 --- a/exercises/practice/poker/tests/poker.rs +++ b/exercises/practice/poker/tests/poker.rs @@ -19,20 +19,20 @@ fn test(input: &[&str], expected: &[&str]) { } #[test] -fn test_single_hand_always_wins() { +fn single_hand_always_wins() { test(&["4S 5S 7H 8D JC"], &["4S 5S 7H 8D JC"]) } #[test] #[ignore] -fn test_duplicate_hands_always_tie() { +fn duplicate_hands_always_tie() { let input = &["3S 4S 5D 6H JH", "3S 4S 5D 6H JH", "3S 4S 5D 6H JH"]; assert_eq!(&winning_hands(input), input) } #[test] #[ignore] -fn test_highest_card_of_all_hands_wins() { +fn highest_card_of_all_hands_wins() { test( &["4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH"], &["3S 4S 5D 6H JH"], @@ -41,7 +41,7 @@ fn test_highest_card_of_all_hands_wins() { #[test] #[ignore] -fn test_a_tie_has_multiple_winners() { +fn a_tie_has_multiple_winners() { test( &[ "4D 5S 6S 8D 3C", @@ -55,7 +55,7 @@ fn test_a_tie_has_multiple_winners() { #[test] #[ignore] -fn test_high_card_can_be_low_card_in_an_otherwise_tie() { +fn high_card_can_be_low_card_in_an_otherwise_tie() { // multiple hands with the same high cards, tie compares next highest ranked, // down to last card test(&["3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S"], &["3S 5H 6S 8D 7H"]) @@ -63,32 +63,32 @@ fn test_high_card_can_be_low_card_in_an_otherwise_tie() { #[test] #[ignore] -fn test_one_pair_beats_high_card() { +fn one_pair_beats_high_card() { test(&["4S 5H 6C 8D KH", "2S 4H 6S 4D JH"], &["2S 4H 6S 4D JH"]) } #[test] #[ignore] -fn test_highest_pair_wins() { +fn highest_pair_wins() { test(&["4S 2H 6S 2D JH", "2S 4H 6C 4D JD"], &["2S 4H 6C 4D JD"]) } #[test] #[ignore] -fn test_two_pairs_beats_one_pair() { +fn two_pairs_beats_one_pair() { test(&["2S 8H 6S 8D JH", "4S 5H 4C 8C 5C"], &["4S 5H 4C 8C 5C"]) } #[test] #[ignore] -fn test_two_pair_ranks() { +fn two_pair_ranks() { // both hands have two pairs, highest ranked pair wins test(&["2S 8H 2D 8D 3H", "4S 5H 4C 8S 5D"], &["2S 8H 2D 8D 3H"]) } #[test] #[ignore] -fn test_two_pairs_second_pair_cascade() { +fn two_pairs_second_pair_cascade() { // both hands have two pairs, with the same highest ranked pair, // tie goes to low pair test(&["2S QS 2C QD JH", "JD QH JS 8D QC"], &["JD QH JS 8D QC"]) @@ -96,7 +96,7 @@ fn test_two_pairs_second_pair_cascade() { #[test] #[ignore] -fn test_two_pairs_last_card_cascade() { +fn two_pairs_last_card_cascade() { // both hands have two identically ranked pairs, // tie goes to remaining card (kicker) test(&["JD QH JS 8D QC", "JS QS JC 2D QD"], &["JD QH JS 8D QC"]) @@ -104,26 +104,26 @@ fn test_two_pairs_last_card_cascade() { #[test] #[ignore] -fn test_three_of_a_kind_beats_two_pair() { +fn three_of_a_kind_beats_two_pair() { test(&["2S 8H 2H 8D JH", "4S 5H 4C 8S 4H"], &["4S 5H 4C 8S 4H"]) } #[test] #[ignore] -fn test_three_of_a_kind_ranks() { +fn three_of_a_kind_ranks() { //both hands have three of a kind, tie goes to highest ranked triplet test(&["2S 2H 2C 8D JH", "4S AH AS 8C AD"], &["4S AH AS 8C AD"]) } #[test] #[ignore] -fn test_low_three_of_a_kind_beats_high_two_pair() { +fn low_three_of_a_kind_beats_high_two_pair() { test(&["2H 2D 2C 8H 5H", "AS AC KS KC 6S"], &["2H 2D 2C 8H 5H"]) } #[test] #[ignore] -fn test_three_of_a_kind_cascade_ranks() { +fn three_of_a_kind_cascade_ranks() { // with multiple decks, two players can have same three of a kind, // ties go to highest remaining cards test(&["4S AH AS 7C AD", "4S AH AS 8C AD"], &["4S AH AS 8C AD"]) @@ -131,135 +131,135 @@ fn test_three_of_a_kind_cascade_ranks() { #[test] #[ignore] -fn test_straight_beats_three_of_a_kind() { +fn straight_beats_three_of_a_kind() { test(&["4S 5H 4C 8D 4H", "3S 4D 2S 6D 5C"], &["3S 4D 2S 6D 5C"]) } #[test] #[ignore] -fn test_aces_can_end_a_straight_high() { +fn aces_can_end_a_straight_high() { // aces can end a straight (10 J Q K A) test(&["4S 5H 4C 8D 4H", "10D JH QS KD AC"], &["10D JH QS KD AC"]) } #[test] #[ignore] -fn test_aces_can_start_a_straight_low() { +fn aces_can_start_a_straight_low() { // aces can start a straight (A 2 3 4 5) test(&["4S 5H 4C 8D 4H", "4D AH 3S 2D 5C"], &["4D AH 3S 2D 5C"]) } #[test] #[ignore] -fn test_no_ace_in_middle_of_straight() { +fn no_ace_in_middle_of_straight() { // aces cannot be in the middle of a straight (Q K A 2 3) test(&["2C 3D 7H 5H 2S", "QS KH AC 2D 3S"], &["2C 3D 7H 5H 2S"]) } #[test] #[ignore] -fn test_straight_ranks() { +fn straight_ranks() { // both hands with a straight, tie goes to highest ranked card test(&["4S 6C 7S 8D 5H", "5S 7H 8S 9D 6H"], &["5S 7H 8S 9D 6H"]) } #[test] #[ignore] -fn test_straight_scoring() { +fn straight_scoring() { // even though an ace is usually high, a 5-high straight is the lowest-scoring straight test(&["2H 3C 4D 5D 6H", "4S AH 3S 2D 5H"], &["2H 3C 4D 5D 6H"]) } #[test] #[ignore] -fn test_flush_beats_a_straight() { +fn flush_beats_a_straight() { test(&["4C 6H 7D 8D 5H", "2S 4S 5S 6S 7S"], &["2S 4S 5S 6S 7S"]) } #[test] #[ignore] -fn test_flush_cascade() { +fn flush_cascade() { // both hands have a flush, tie goes to high card, down to the last one if necessary test(&["4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S"], &["4H 7H 8H 9H 6H"]) } #[test] #[ignore] -fn test_full_house_beats_a_flush() { +fn full_house_beats_a_flush() { test(&["3H 6H 7H 8H 5H", "4S 5C 4C 5D 4H"], &["4S 5C 4C 5D 4H"]) } #[test] #[ignore] -fn test_full_house_ranks() { +fn full_house_ranks() { // both hands have a full house, tie goes to highest-ranked triplet test(&["4H 4S 4D 9S 9D", "5H 5S 5D 8S 8D"], &["5H 5S 5D 8S 8D"]) } #[test] #[ignore] -fn test_full_house_cascade() { +fn full_house_cascade() { // with multiple decks, both hands have a full house with the same triplet, tie goes to the pair test(&["5H 5S 5D 9S 9D", "5H 5S 5D 8S 8D"], &["5H 5S 5D 9S 9D"]) } #[test] #[ignore] -fn test_four_of_a_kind_beats_full_house() { +fn four_of_a_kind_beats_full_house() { test(&["4S 5H 4D 5D 4H", "3S 3H 2S 3D 3C"], &["3S 3H 2S 3D 3C"]) } #[test] #[ignore] -fn test_four_of_a_kind_ranks() { +fn four_of_a_kind_ranks() { // both hands have four of a kind, tie goes to high quad test(&["2S 2H 2C 8D 2D", "4S 5H 5S 5D 5C"], &["4S 5H 5S 5D 5C"]) } #[test] #[ignore] -fn test_four_of_a_kind_cascade() { +fn four_of_a_kind_cascade() { // with multiple decks, both hands with identical four of a kind, tie determined by kicker test(&["3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C"], &["3S 3H 4S 3D 3C"]) } #[test] #[ignore] -fn test_straight_flush_beats_four_of_a_kind() { +fn straight_flush_beats_four_of_a_kind() { test(&["4S 5H 5S 5D 5C", "7S 8S 9S 6S 10S"], &["7S 8S 9S 6S 10S"]) } #[test] #[ignore] -fn test_aces_can_end_a_straight_flush_high() { +fn aces_can_end_a_straight_flush_high() { // aces can end a straight flush (10 J Q K A) test(&["KC AH AS AD AC", "10C JC QC KC AC"], &["10C JC QC KC AC"]) } #[test] #[ignore] -fn test_aces_can_start_a_straight_flush_low() { +fn aces_can_start_a_straight_flush_low() { // aces can start a straight flush (A 2 3 4 5) test(&["KS AH AS AD AC", "4H AH 3H 2H 5H"], &["4H AH 3H 2H 5H"]) } #[test] #[ignore] -fn test_no_ace_in_middle_of_straight_flush() { +fn no_ace_in_middle_of_straight_flush() { // aces cannot be in the middle of a straight flush (Q K A 2 3) test(&["2C AC QC 10C KC", "QH KH AH 2H 3H"], &["2C AC QC 10C KC"]) } #[test] #[ignore] -fn test_straight_flush_ranks() { +fn straight_flush_ranks() { // both hands have a straight flush, tie goes to highest-ranked card test(&["4H 6H 7H 8H 5H", "5S 7S 8S 9S 6S"], &["5S 7S 8S 9S 6S"]) } #[test] #[ignore] -fn test_straight_flush_scoring() { +fn straight_flush_scoring() { // even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush test(&["2H 3H 4H 5H 6H", "4D AD 3D 2D 5D"], &["2H 3H 4H 5H 6H"]) } diff --git a/exercises/practice/prime-factors/tests/prime-factors.rs b/exercises/practice/prime-factors/tests/prime-factors.rs index 3c17ec50a..2b66f2ac7 100644 --- a/exercises/practice/prime-factors/tests/prime-factors.rs +++ b/exercises/practice/prime-factors/tests/prime-factors.rs @@ -1,42 +1,42 @@ use prime_factors::factors; #[test] -fn test_no_factors() { +fn no_factors() { assert_eq!(factors(1), vec![]); } #[test] #[ignore] -fn test_prime_number() { +fn prime_number() { assert_eq!(factors(2), vec![2]); } #[test] #[ignore] -fn test_square_of_a_prime() { +fn square_of_a_prime() { assert_eq!(factors(9), vec![3, 3]); } #[test] #[ignore] -fn test_cube_of_a_prime() { +fn cube_of_a_prime() { assert_eq!(factors(8), vec![2, 2, 2]); } #[test] #[ignore] -fn test_product_of_primes_and_non_primes() { +fn product_of_primes_and_non_primes() { assert_eq!(factors(12), vec![2, 2, 3]); } #[test] #[ignore] -fn test_product_of_primes() { +fn product_of_primes() { assert_eq!(factors(901_255), vec![5, 17, 23, 461]); } #[test] #[ignore] -fn test_factors_include_large_prime() { +fn factors_include_large_prime() { assert_eq!(factors(93_819_012_551), vec![11, 9539, 894_119]); } diff --git a/exercises/practice/protein-translation/tests/protein-translation.rs b/exercises/practice/protein-translation/tests/protein-translation.rs index 828efab00..d7c0369d0 100644 --- a/exercises/practice/protein-translation/tests/protein-translation.rs +++ b/exercises/practice/protein-translation/tests/protein-translation.rs @@ -1,42 +1,42 @@ use protein_translation as proteins; #[test] -fn test_methionine() { +fn methionine() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("AUG"), Some("methionine")); } #[test] #[ignore] -fn test_cysteine_tgt() { +fn cysteine_tgt() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("UGU"), Some("cysteine")); } #[test] #[ignore] -fn test_stop() { +fn stop() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("UAA"), Some("stop codon")); } #[test] #[ignore] -fn test_valine() { +fn valine() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("GUU"), Some("valine")); } #[test] #[ignore] -fn test_isoleucine() { +fn isoleucine() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("AUU"), Some("isoleucine")); } #[test] #[ignore] -fn test_arginine_name() { +fn arginine_name() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("CGA"), Some("arginine")); assert_eq!(info.name_for("AGA"), Some("arginine")); @@ -73,7 +73,7 @@ fn too_long_is_invalid() { #[test] #[ignore] -fn test_translates_rna_strand_into_correct_protein() { +fn translates_rna_strand_into_correct_protein() { let info = proteins::parse(make_pairs()); assert_eq!( info.of_rna("AUGUUUUGG"), @@ -83,7 +83,7 @@ fn test_translates_rna_strand_into_correct_protein() { #[test] #[ignore] -fn test_stops_translation_if_stop_codon_present() { +fn stops_translation_if_stop_codon_present() { let info = proteins::parse(make_pairs()); assert_eq!( info.of_rna("AUGUUUUAA"), @@ -93,7 +93,7 @@ fn test_stops_translation_if_stop_codon_present() { #[test] #[ignore] -fn test_stops_translation_of_longer_strand() { +fn stops_translation_of_longer_strand() { let info = proteins::parse(make_pairs()); assert_eq!( info.of_rna("UGGUGUUAUUAAUGGUUU"), @@ -103,21 +103,21 @@ fn test_stops_translation_of_longer_strand() { #[test] #[ignore] -fn test_invalid_codons() { +fn invalid_codons() { let info = proteins::parse(make_pairs()); assert!(info.of_rna("CARROT").is_none()); } #[test] #[ignore] -fn test_invalid_length() { +fn invalid_length() { let info = proteins::parse(make_pairs()); assert!(info.of_rna("AUGUA").is_none()); } #[test] #[ignore] -fn test_valid_stopped_rna() { +fn valid_stopped_rna() { let info = proteins::parse(make_pairs()); assert_eq!(info.of_rna("AUGUAAASDF"), Some(vec!["methionine"])); } diff --git a/exercises/practice/proverb/tests/proverb.rs b/exercises/practice/proverb/tests/proverb.rs index a19c2cae5..5a921790e 100644 --- a/exercises/practice/proverb/tests/proverb.rs +++ b/exercises/practice/proverb/tests/proverb.rs @@ -1,7 +1,7 @@ use proverb::build_proverb; #[test] -fn test_two_pieces() { +fn two_pieces() { let input = vec!["nail", "shoe"]; let expected = [ "For want of a nail the shoe was lost.", @@ -14,7 +14,7 @@ fn test_two_pieces() { // Notice the change in the last line at three pieces. #[test] #[ignore] -fn test_three_pieces() { +fn three_pieces() { let input = vec!["nail", "shoe", "horse"]; let expected = [ "For want of a nail the shoe was lost.", @@ -27,7 +27,7 @@ fn test_three_pieces() { #[test] #[ignore] -fn test_one_piece() { +fn one_piece() { let input = vec!["nail"]; let expected = String::from("And all for the want of a nail."); assert_eq!(build_proverb(&input), expected); @@ -35,7 +35,7 @@ fn test_one_piece() { #[test] #[ignore] -fn test_zero_pieces() { +fn zero_pieces() { let input: Vec<&str> = vec![]; let expected = String::new(); assert_eq!(build_proverb(&input), expected); @@ -43,7 +43,7 @@ fn test_zero_pieces() { #[test] #[ignore] -fn test_full() { +fn full() { let input = vec![ "nail", "shoe", "horse", "rider", "message", "battle", "kingdom", ]; @@ -62,7 +62,7 @@ fn test_full() { #[test] #[ignore] -fn test_three_pieces_modernized() { +fn three_pieces_modernized() { let input = vec!["pin", "gun", "soldier", "battle"]; let expected = [ "For want of a pin the gun was lost.", diff --git a/exercises/practice/pythagorean-triplet/tests/pythagorean-triplet.rs b/exercises/practice/pythagorean-triplet/tests/pythagorean-triplet.rs index 3ca5c3728..45c255094 100644 --- a/exercises/practice/pythagorean-triplet/tests/pythagorean-triplet.rs +++ b/exercises/practice/pythagorean-triplet/tests/pythagorean-triplet.rs @@ -14,37 +14,37 @@ fn process_tripletswithsum_case(sum: u32, expected: &[[u32; 3]]) { } #[test] -fn test_triplets_whose_sum_is_12() { +fn triplets_whose_sum_is_12() { process_tripletswithsum_case(12, &[[3, 4, 5]]); } #[test] #[ignore] -fn test_triplets_whose_sum_is_108() { +fn triplets_whose_sum_is_108() { process_tripletswithsum_case(108, &[[27, 36, 45]]); } #[test] #[ignore] -fn test_triplets_whose_sum_is_1000() { +fn triplets_whose_sum_is_1000() { process_tripletswithsum_case(1000, &[[200, 375, 425]]); } #[test] #[ignore] -fn test_no_matching_triplets_for_1001() { +fn no_matching_triplets_for_1001() { process_tripletswithsum_case(1001, &[]); } #[test] #[ignore] -fn test_returns_all_matching_triplets() { +fn returns_all_matching_triplets() { process_tripletswithsum_case(90, &[[9, 40, 41], [15, 36, 39]]); } #[test] #[ignore] -fn test_several_matching_triplets() { +fn several_matching_triplets() { process_tripletswithsum_case( 840, &[ @@ -62,7 +62,7 @@ fn test_several_matching_triplets() { #[test] #[ignore] -fn test_triplets_for_large_number() { +fn triplets_for_large_number() { process_tripletswithsum_case( 30_000, &[ diff --git a/exercises/practice/rail-fence-cipher/tests/rail-fence-cipher.rs b/exercises/practice/rail-fence-cipher/tests/rail-fence-cipher.rs index 399f0c6da..66daa2137 100644 --- a/exercises/practice/rail-fence-cipher/tests/rail-fence-cipher.rs +++ b/exercises/practice/rail-fence-cipher/tests/rail-fence-cipher.rs @@ -32,21 +32,21 @@ fn process_decode_case(input: &str, rails: u32, expected: &str) { #[test] /// encode with two rails -fn test_encode_with_two_rails() { +fn encode_with_two_rails() { process_encode_case("XOXOXOXOXOXOXOXOXO", 2, "XXXXXXXXXOOOOOOOOO"); } #[test] #[ignore] /// encode with three rails -fn test_encode_with_three_rails() { +fn encode_with_three_rails() { process_encode_case("WEAREDISCOVEREDFLEEATONCE", 3, "WECRLTEERDSOEEFEAOCAIVDEN"); } #[test] #[ignore] /// encode with ending in the middle -fn test_encode_with_ending_in_the_middle() { +fn encode_with_ending_in_the_middle() { process_encode_case("EXERCISES", 4, "ESXIEECSR"); } @@ -55,21 +55,21 @@ fn test_encode_with_ending_in_the_middle() { #[test] #[ignore] /// decode with three rails -fn test_decode_with_three_rails() { +fn decode_with_three_rails() { process_decode_case("TEITELHDVLSNHDTISEIIEA", 3, "THEDEVILISINTHEDETAILS"); } #[test] #[ignore] /// decode with five rails -fn test_decode_with_five_rails() { +fn decode_with_five_rails() { process_decode_case("EIEXMSMESAORIWSCE", 5, "EXERCISMISAWESOME"); } #[test] #[ignore] /// decode with six rails -fn test_decode_with_six_rails() { +fn decode_with_six_rails() { process_decode_case( "133714114238148966225439541018335470986172518171757571896261", 6, @@ -87,6 +87,6 @@ fn test_decode_with_six_rails() { /// /// this text is possibly one of the most famous haiku of all time, by /// Matsuo Bashō (松尾芭蕉) -fn test_encode_wide_characters() { +fn encode_wide_characters() { process_encode_case("古池蛙飛び込む水の音", 3, "古びの池飛込水音蛙む"); } diff --git a/exercises/practice/react/tests/react.rs b/exercises/practice/react/tests/react.rs index af053b2d2..1735e6632 100644 --- a/exercises/practice/react/tests/react.rs +++ b/exercises/practice/react/tests/react.rs @@ -403,7 +403,7 @@ fn callbacks_should_not_be_called_if_dependencies_change_but_output_value_doesnt #[test] #[ignore] -fn test_adder_with_boolean_values() { +fn adder_with_boolean_values() { // This is a digital logic circuit called an adder: // https://en.wikipedia.org/wiki/Adder_(electronics) let mut reactor = Reactor::new(); diff --git a/exercises/practice/rectangles/tests/rectangles.rs b/exercises/practice/rectangles/tests/rectangles.rs index e8863eb8b..c3f72237c 100644 --- a/exercises/practice/rectangles/tests/rectangles.rs +++ b/exercises/practice/rectangles/tests/rectangles.rs @@ -1,28 +1,28 @@ use rectangles::count; #[test] -fn test_zero_area_1() { +fn zero_area_1() { let lines = &[]; assert_eq!(0, count(lines)) } #[test] #[ignore] -fn test_zero_area_2() { +fn zero_area_2() { let lines = &[""]; assert_eq!(0, count(lines)) } #[test] #[ignore] -fn test_empty_area() { +fn empty_area() { let lines = &[" "]; assert_eq!(0, count(lines)) } #[test] #[ignore] -fn test_one_rectangle() { +fn one_rectangle() { #[rustfmt::skip] let lines = &[ "+-+", @@ -34,7 +34,7 @@ fn test_one_rectangle() { #[test] #[ignore] -fn test_two_rectangles_no_shared_parts() { +fn two_rectangles_no_shared_parts() { #[rustfmt::skip] let lines = &[ " +-+", @@ -48,7 +48,7 @@ fn test_two_rectangles_no_shared_parts() { #[test] #[ignore] -fn test_five_rectangles_three_regions() { +fn five_rectangles_three_regions() { #[rustfmt::skip] let lines = &[ " +-+", @@ -96,7 +96,7 @@ fn unit_square() { #[test] #[ignore] -fn test_incomplete_rectangles() { +fn incomplete_rectangles() { #[rustfmt::skip] let lines = &[ " +-+", @@ -110,7 +110,7 @@ fn test_incomplete_rectangles() { #[test] #[ignore] -fn test_complicated() { +fn complicated() { let lines = &[ "+------+----+", "| | |", @@ -123,7 +123,7 @@ fn test_complicated() { #[test] #[ignore] -fn test_not_so_complicated() { +fn not_so_complicated() { let lines = &[ "+------+----+", "| | |", @@ -136,7 +136,7 @@ fn test_not_so_complicated() { #[test] #[ignore] -fn test_large_input_with_many_rectangles() { +fn large_input_with_many_rectangles() { let lines = &[ "+---+--+----+", "| +--+----+", @@ -152,7 +152,7 @@ fn test_large_input_with_many_rectangles() { #[test] #[ignore] -fn test_three_rectangles_no_shared_parts() { +fn three_rectangles_no_shared_parts() { #[rustfmt::skip] let lines = &[ " +-+ ", diff --git a/exercises/practice/reverse-string/tests/reverse-string.rs b/exercises/practice/reverse-string/tests/reverse-string.rs index b6f5b85e3..b80eef344 100644 --- a/exercises/practice/reverse-string/tests/reverse-string.rs +++ b/exercises/practice/reverse-string/tests/reverse-string.rs @@ -14,49 +14,49 @@ fn process_reverse_case(input: &str, expected: &str) { #[test] /// empty string -fn test_an_empty_string() { +fn an_empty_string() { process_reverse_case("", ""); } #[test] #[ignore] /// a word -fn test_a_word() { +fn a_word() { process_reverse_case("robot", "tobor"); } #[test] #[ignore] /// a capitalized word -fn test_a_capitalized_word() { +fn a_capitalized_word() { process_reverse_case("Ramen", "nemaR"); } #[test] #[ignore] /// a sentence with punctuation -fn test_a_sentence_with_punctuation() { +fn a_sentence_with_punctuation() { process_reverse_case("I'm hungry!", "!yrgnuh m'I"); } #[test] #[ignore] /// a palindrome -fn test_a_palindrome() { +fn a_palindrome() { process_reverse_case("racecar", "racecar"); } #[test] #[ignore] /// an even-sized word -fn test_an_even_sized_word() { +fn an_even_sized_word() { process_reverse_case("drawer", "reward"); } #[test] #[ignore] /// wide characters -fn test_wide_characters() { +fn wide_characters() { process_reverse_case("子猫", "猫子"); } @@ -64,6 +64,6 @@ fn test_wide_characters() { #[ignore] #[cfg(feature = "grapheme")] /// grapheme clusters -fn test_grapheme_clusters() { +fn grapheme_clusters() { process_reverse_case("uüu", "uüu"); } diff --git a/exercises/practice/rna-transcription/tests/rna-transcription.rs b/exercises/practice/rna-transcription/tests/rna-transcription.rs index 11c727f38..63e81c8e9 100644 --- a/exercises/practice/rna-transcription/tests/rna-transcription.rs +++ b/exercises/practice/rna-transcription/tests/rna-transcription.rs @@ -1,19 +1,19 @@ use rna_transcription as dna; #[test] -fn test_valid_dna_input() { +fn valid_dna_input() { assert!(dna::Dna::new("GCTA").is_ok()); } #[test] #[ignore] -fn test_valid_rna_input() { +fn valid_rna_input() { assert!(dna::Rna::new("CGAU").is_ok()); } #[test] #[ignore] -fn test_invalid_dna_input() { +fn invalid_dna_input() { // Invalid character assert_eq!(dna::Dna::new("X").err(), Some(0)); // Valid nucleotide, but invalid in context @@ -24,7 +24,7 @@ fn test_invalid_dna_input() { #[test] #[ignore] -fn test_invalid_rna_input() { +fn invalid_rna_input() { // Invalid character assert_eq!(dna::Rna::new("X").unwrap_err(), 0); // Valid nucleotide, but invalid in context @@ -35,7 +35,7 @@ fn test_invalid_rna_input() { #[test] #[ignore] -fn test_acid_equals_acid() { +fn acid_equals_acid() { assert_eq!(dna::Dna::new("CGA").unwrap(), dna::Dna::new("CGA").unwrap()); assert_ne!(dna::Dna::new("CGA").unwrap(), dna::Dna::new("AGC").unwrap()); assert_eq!(dna::Rna::new("CGA").unwrap(), dna::Rna::new("CGA").unwrap()); @@ -44,7 +44,7 @@ fn test_acid_equals_acid() { #[test] #[ignore] -fn test_transcribes_cytosine_guanine() { +fn transcribes_cytosine_guanine() { assert_eq!( dna::Rna::new("G").unwrap(), dna::Dna::new("C").unwrap().into_rna() @@ -53,7 +53,7 @@ fn test_transcribes_cytosine_guanine() { #[test] #[ignore] -fn test_transcribes_guanine_cytosine() { +fn transcribes_guanine_cytosine() { assert_eq!( dna::Rna::new("C").unwrap(), dna::Dna::new("G").unwrap().into_rna() @@ -62,7 +62,7 @@ fn test_transcribes_guanine_cytosine() { #[test] #[ignore] -fn test_transcribes_adenine_uracil() { +fn transcribes_adenine_uracil() { assert_eq!( dna::Rna::new("U").unwrap(), dna::Dna::new("A").unwrap().into_rna() @@ -71,7 +71,7 @@ fn test_transcribes_adenine_uracil() { #[test] #[ignore] -fn test_transcribes_thymine_to_adenine() { +fn transcribes_thymine_to_adenine() { assert_eq!( dna::Rna::new("A").unwrap(), dna::Dna::new("T").unwrap().into_rna() @@ -80,7 +80,7 @@ fn test_transcribes_thymine_to_adenine() { #[test] #[ignore] -fn test_transcribes_all_dna_to_rna() { +fn transcribes_all_dna_to_rna() { assert_eq!( dna::Rna::new("UGCACCAGAAUU").unwrap(), dna::Dna::new("ACGTGGTCTTAA").unwrap().into_rna() diff --git a/exercises/practice/robot-name/tests/robot-name.rs b/exercises/practice/robot-name/tests/robot-name.rs index ab848297d..011b3c0b2 100644 --- a/exercises/practice/robot-name/tests/robot-name.rs +++ b/exercises/practice/robot-name/tests/robot-name.rs @@ -22,20 +22,20 @@ fn assert_name_is_persistent(r: &robot::Robot) { } #[test] -fn test_name_should_match_expected_pattern() { +fn name_should_match_expected_pattern() { let r = robot::Robot::new(); assert_name_matches_pattern(r.name()); } #[test] #[ignore] -fn test_name_is_persistent() { +fn name_is_persistent() { assert_name_is_persistent(&robot::Robot::new()); } #[test] #[ignore] -fn test_different_robots_have_different_names() { +fn different_robots_have_different_names() { let r1 = robot::Robot::new(); let r2 = robot::Robot::new(); assert_ne!(r1.name(), r2.name(), "Robot names should be different"); @@ -43,7 +43,7 @@ fn test_different_robots_have_different_names() { #[test] #[ignore] -fn test_many_different_robots_have_different_names() { +fn many_different_robots_have_different_names() { use std::collections::HashSet; // In 3,529 random robot names, there is ~99.99% chance of a name collision @@ -56,7 +56,7 @@ fn test_many_different_robots_have_different_names() { #[test] #[ignore] -fn test_new_name_should_match_expected_pattern() { +fn new_name_should_match_expected_pattern() { let mut r = robot::Robot::new(); assert_name_matches_pattern(r.name()); r.reset_name(); @@ -65,7 +65,7 @@ fn test_new_name_should_match_expected_pattern() { #[test] #[ignore] -fn test_new_name_is_persistent() { +fn new_name_is_persistent() { let mut r = robot::Robot::new(); r.reset_name(); assert_name_is_persistent(&r); @@ -73,7 +73,7 @@ fn test_new_name_is_persistent() { #[test] #[ignore] -fn test_new_name_is_different_from_old_name() { +fn new_name_is_different_from_old_name() { let mut r = robot::Robot::new(); let n1 = r.name().to_string(); r.reset_name(); diff --git a/exercises/practice/roman-numerals/tests/roman-numerals.rs b/exercises/practice/roman-numerals/tests/roman-numerals.rs index cb175fec2..7a3337666 100644 --- a/exercises/practice/roman-numerals/tests/roman-numerals.rs +++ b/exercises/practice/roman-numerals/tests/roman-numerals.rs @@ -1,67 +1,67 @@ use roman_numerals::*; #[test] -fn test_one() { +fn one() { assert_eq!("I", Roman::from(1).to_string()); } #[test] #[ignore] -fn test_two() { +fn two() { assert_eq!("II", Roman::from(2).to_string()); } #[test] #[ignore] -fn test_three() { +fn three() { assert_eq!("III", Roman::from(3).to_string()); } #[test] #[ignore] -fn test_four() { +fn four() { assert_eq!("IV", Roman::from(4).to_string()); } #[test] #[ignore] -fn test_five() { +fn five() { assert_eq!("V", Roman::from(5).to_string()); } #[test] #[ignore] -fn test_six() { +fn six() { assert_eq!("VI", Roman::from(6).to_string()); } #[test] #[ignore] -fn test_nine() { +fn nine() { assert_eq!("IX", Roman::from(9).to_string()); } #[test] #[ignore] -fn test_twenty_seven() { +fn twenty_seven() { assert_eq!("XXVII", Roman::from(27).to_string()); } #[test] #[ignore] -fn test_forty_eight() { +fn forty_eight() { assert_eq!("XLVIII", Roman::from(48).to_string()); } #[test] #[ignore] -fn test_fifty_nine() { +fn fifty_nine() { assert_eq!("LIX", Roman::from(59).to_string()); } #[test] #[ignore] -fn test_ninety_three() { +fn ninety_three() { assert_eq!("XCIII", Roman::from(93).to_string()); } diff --git a/exercises/practice/run-length-encoding/tests/run-length-encoding.rs b/exercises/practice/run-length-encoding/tests/run-length-encoding.rs index bcb208e36..5f8354738 100644 --- a/exercises/practice/run-length-encoding/tests/run-length-encoding.rs +++ b/exercises/practice/run-length-encoding/tests/run-length-encoding.rs @@ -3,25 +3,25 @@ use run_length_encoding as rle; // encoding tests #[test] -fn test_encode_empty_string() { +fn encode_empty_string() { assert_eq!("", rle::encode("")); } #[test] #[ignore] -fn test_encode_single_characters() { +fn encode_single_characters() { assert_eq!("XYZ", rle::encode("XYZ")); } #[test] #[ignore] -fn test_encode_string_with_no_single_characters() { +fn encode_string_with_no_single_characters() { assert_eq!("2A3B4C", rle::encode("AABBBCCCC")); } #[test] #[ignore] -fn test_encode_single_characters_mixed_with_repeated_characters() { +fn encode_single_characters_mixed_with_repeated_characters() { assert_eq!( "12WB12W3B24WB", rle::encode("WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB") @@ -30,13 +30,13 @@ fn test_encode_single_characters_mixed_with_repeated_characters() { #[test] #[ignore] -fn test_encode_multiple_whitespace_mixed_in_string() { +fn encode_multiple_whitespace_mixed_in_string() { assert_eq!("2 hs2q q2w2 ", rle::encode(" hsqq qww ")); } #[test] #[ignore] -fn test_encode_lowercase_characters() { +fn encode_lowercase_characters() { assert_eq!("2a3b4c", rle::encode("aabbbcccc")); } @@ -44,25 +44,25 @@ fn test_encode_lowercase_characters() { #[test] #[ignore] -fn test_decode_empty_string() { +fn decode_empty_string() { assert_eq!("", rle::decode("")); } #[test] #[ignore] -fn test_decode_single_characters_only() { +fn decode_single_characters_only() { assert_eq!("XYZ", rle::decode("XYZ")); } #[test] #[ignore] -fn test_decode_string_with_no_single_characters() { +fn decode_string_with_no_single_characters() { assert_eq!("AABBBCCCC", rle::decode("2A3B4C")); } #[test] #[ignore] -fn test_decode_single_characters_with_repeated_characters() { +fn decode_single_characters_with_repeated_characters() { assert_eq!( "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB", rle::decode("12WB12W3B24WB") @@ -71,13 +71,13 @@ fn test_decode_single_characters_with_repeated_characters() { #[test] #[ignore] -fn test_decode_multiple_whitespace_mixed_in_string() { +fn decode_multiple_whitespace_mixed_in_string() { assert_eq!(" hsqq qww ", rle::decode("2 hs2q q2w2 ")); } #[test] #[ignore] -fn test_decode_lower_case_string() { +fn decode_lower_case_string() { assert_eq!("aabbbcccc", rle::decode("2a3b4c")); } @@ -85,7 +85,7 @@ fn test_decode_lower_case_string() { #[test] #[ignore] -fn test_consistency() { +fn consistency() { assert_eq!( "zzz ZZ zZ", rle::decode(rle::encode("zzz ZZ zZ").as_str()) diff --git a/exercises/practice/say/tests/say.rs b/exercises/practice/say/tests/say.rs index dc320dd96..02a17fc10 100644 --- a/exercises/practice/say/tests/say.rs +++ b/exercises/practice/say/tests/say.rs @@ -3,7 +3,7 @@ // where it is common in British English to use the 'and'. #[test] -fn test_zero() { +fn zero() { assert_eq!(say::encode(0), String::from("zero")); } @@ -13,63 +13,63 @@ fn test_zero() { /* #[test] #[ignore] -fn test_negative() { +fn negative() { assert_eq!(say::encode(-1), String::from("won't compile")); } */ #[test] #[ignore] -fn test_one() { +fn one() { assert_eq!(say::encode(1), String::from("one")); } #[test] #[ignore] -fn test_fourteen() { +fn fourteen() { assert_eq!(say::encode(14), String::from("fourteen")); } #[test] #[ignore] -fn test_twenty() { +fn twenty() { assert_eq!(say::encode(20), String::from("twenty")); } #[test] #[ignore] -fn test_twenty_two() { +fn twenty_two() { assert_eq!(say::encode(22), String::from("twenty-two")); } #[test] #[ignore] -fn test_one_hundred() { +fn one_hundred() { assert_eq!(say::encode(100), String::from("one hundred")); } // note, using American style with no and #[test] #[ignore] -fn test_one_hundred_twenty() { +fn one_hundred_twenty() { assert_eq!(say::encode(120), String::from("one hundred twenty")); } #[test] #[ignore] -fn test_one_hundred_twenty_three() { +fn one_hundred_twenty_three() { assert_eq!(say::encode(123), String::from("one hundred twenty-three")); } #[test] #[ignore] -fn test_one_thousand() { +fn one_thousand() { assert_eq!(say::encode(1000), String::from("one thousand")); } #[test] #[ignore] -fn test_one_thousand_two_hundred_thirty_four() { +fn one_thousand_two_hundred_thirty_four() { assert_eq!( say::encode(1234), String::from("one thousand two hundred thirty-four") @@ -79,7 +79,7 @@ fn test_one_thousand_two_hundred_thirty_four() { // note, using American style with no and #[test] #[ignore] -fn test_eight_hundred_and_ten_thousand() { +fn eight_hundred_and_ten_thousand() { assert_eq!( say::encode(810_000), String::from("eight hundred ten thousand") @@ -88,20 +88,20 @@ fn test_eight_hundred_and_ten_thousand() { #[test] #[ignore] -fn test_one_million() { +fn one_million() { assert_eq!(say::encode(1_000_000), String::from("one million")); } // note, using American style with no and #[test] #[ignore] -fn test_one_million_two() { +fn one_million_two() { assert_eq!(say::encode(1_000_002), String::from("one million two")); } #[test] #[ignore] -fn test_1002345() { +fn one_million_two_thousand_three_hundred_forty_five() { assert_eq!( say::encode(1_002_345), String::from("one million two thousand three hundred forty-five") @@ -110,7 +110,7 @@ fn test_1002345() { #[test] #[ignore] -fn test_one_billion() { +fn one_billion() { assert_eq!(say::encode(1_000_000_000), String::from("one billion")); } @@ -133,7 +133,7 @@ fn test_987654321123() { */ #[test] #[ignore] -fn test_max_i64() { +fn max_i64() { assert_eq!( say::encode(9_223_372_036_854_775_807), String::from( @@ -147,7 +147,7 @@ fn test_max_i64() { #[test] #[ignore] -fn test_max_u64() { +fn max_u64() { assert_eq!( say::encode(18_446_744_073_709_551_615), String::from( diff --git a/exercises/practice/scale-generator/.meta/example.rs b/exercises/practice/scale-generator/.meta/example.rs index ceddf50f4..779218909 100644 --- a/exercises/practice/scale-generator/.meta/example.rs +++ b/exercises/practice/scale-generator/.meta/example.rs @@ -102,17 +102,17 @@ pub mod interval { use super::*; #[test] - fn test_parse_chromatic() { + fn parse_chromatic() { assert!("mmmmmmmmmmmm".parse::().is_ok()); } #[test] - fn test_parse_major() { + fn parse_major() { assert!("MMmMMMm".parse::().is_ok()); } #[test] - fn test_parse_minor() { + fn parse_minor() { assert!("MmMMmMM".parse::().is_ok()); } } diff --git a/exercises/practice/scale-generator/tests/scale-generator.rs b/exercises/practice/scale-generator/tests/scale-generator.rs index 8d2bcd92a..2119a91ea 100644 --- a/exercises/practice/scale-generator/tests/scale-generator.rs +++ b/exercises/practice/scale-generator/tests/scale-generator.rs @@ -31,7 +31,7 @@ fn process_interval_case(tonic: &str, intervals: &str, expected: &[&str]) { #[test] /// Chromatic scale with sharps -fn test_chromatic_scale_with_sharps() { +fn chromatic_scale_with_sharps() { process_chromatic_case( "C", &[ @@ -43,7 +43,7 @@ fn test_chromatic_scale_with_sharps() { #[test] #[ignore] /// Chromatic scale with flats -fn test_chromatic_scale_with_flats() { +fn chromatic_scale_with_flats() { process_chromatic_case( "F", &[ @@ -61,28 +61,28 @@ fn test_chromatic_scale_with_flats() { /// Simple major scale /// /// The simplest major scale, with no sharps or flats. -fn test_simple_major_scale() { +fn simple_major_scale() { process_interval_case("C", "MMmMMMm", &["C", "D", "E", "F", "G", "A", "B", "C"]); } #[test] #[ignore] /// Major scale with sharps -fn test_major_scale_with_sharps() { +fn major_scale_with_sharps() { process_interval_case("G", "MMmMMMm", &["G", "A", "B", "C", "D", "E", "F#", "G"]); } #[test] #[ignore] /// Major scale with flats -fn test_major_scale_with_flats() { +fn major_scale_with_flats() { process_interval_case("F", "MMmMMMm", &["F", "G", "A", "Bb", "C", "D", "E", "F"]); } #[test] #[ignore] /// Minor scale with sharps -fn test_minor_scale_with_sharps() { +fn minor_scale_with_sharps() { process_interval_case( "f#", "MmMMmMM", @@ -93,7 +93,7 @@ fn test_minor_scale_with_sharps() { #[test] #[ignore] /// Minor scale with flats -fn test_minor_scale_with_flats() { +fn minor_scale_with_flats() { process_interval_case( "bb", "MmMMmMM", @@ -104,14 +104,14 @@ fn test_minor_scale_with_flats() { #[test] #[ignore] /// Dorian mode -fn test_dorian_mode() { +fn dorian_mode() { process_interval_case("d", "MmMMMmM", &["D", "E", "F", "G", "A", "B", "C", "D"]); } #[test] #[ignore] /// Mixolydian mode -fn test_mixolydian_mode() { +fn mixolydian_mode() { process_interval_case( "Eb", "MMmMMmM", @@ -122,7 +122,7 @@ fn test_mixolydian_mode() { #[test] #[ignore] /// Lydian mode -fn test_lydian_mode() { +fn lydian_mode() { process_interval_case( "a", "MMMmMMm", @@ -133,14 +133,14 @@ fn test_lydian_mode() { #[test] #[ignore] /// Phrygian mode -fn test_phrygian_mode() { +fn phrygian_mode() { process_interval_case("e", "mMMMmMM", &["E", "F", "G", "A", "B", "C", "D", "E"]); } #[test] #[ignore] /// Locrian mode -fn test_locrian_mode() { +fn locrian_mode() { process_interval_case( "g", "mMMmMMM", @@ -153,14 +153,14 @@ fn test_locrian_mode() { /// Harmonic minor /// /// Note that this case introduces the augmented second interval (A) -fn test_harmonic_minor() { +fn harmonic_minor() { process_interval_case("d", "MmMMmAm", &["D", "E", "F", "G", "A", "Bb", "Db", "D"]); } #[test] #[ignore] /// Octatonic -fn test_octatonic() { +fn octatonic() { process_interval_case( "C", "MmMmMmMm", @@ -171,21 +171,21 @@ fn test_octatonic() { #[test] #[ignore] /// Hexatonic -fn test_hexatonic() { +fn hexatonic() { process_interval_case("Db", "MMMMMM", &["Db", "Eb", "F", "G", "A", "B", "Db"]); } #[test] #[ignore] /// Pentatonic -fn test_pentatonic() { +fn pentatonic() { process_interval_case("A", "MMAMA", &["A", "B", "C#", "E", "F#", "A"]); } #[test] #[ignore] /// Enigmatic -fn test_enigmatic() { +fn enigmatic() { process_interval_case( "G", "mAMMMmm", diff --git a/exercises/practice/series/tests/series.rs b/exercises/practice/series/tests/series.rs index ddfb6e2da..4757d8b55 100644 --- a/exercises/practice/series/tests/series.rs +++ b/exercises/practice/series/tests/series.rs @@ -1,14 +1,14 @@ use series::*; #[test] -fn test_with_zero_length() { +fn with_zero_length() { let expected = vec!["".to_string(); 6]; assert_eq!(series("92017", 0), expected); } #[test] #[ignore] -fn test_with_length_2() { +fn with_length_2() { let expected = vec![ "92".to_string(), "20".to_string(), @@ -20,21 +20,21 @@ fn test_with_length_2() { #[test] #[ignore] -fn test_with_numbers_length() { +fn with_numbers_length() { let expected = vec!["92017".to_string()]; assert_eq!(series("92017", 5), expected); } #[test] #[ignore] -fn test_too_long() { +fn too_long() { let expected: Vec = vec![]; assert_eq!(series("92017", 6), expected); } #[test] #[ignore] -fn test_way_too_long() { +fn way_too_long() { let expected: Vec = vec![]; assert_eq!(series("92017", 42), expected); } diff --git a/exercises/practice/simple-linked-list/tests/simple-linked-list.rs b/exercises/practice/simple-linked-list/tests/simple-linked-list.rs index a95a66665..896528666 100644 --- a/exercises/practice/simple-linked-list/tests/simple-linked-list.rs +++ b/exercises/practice/simple-linked-list/tests/simple-linked-list.rs @@ -1,14 +1,14 @@ use simple_linked_list::SimpleLinkedList; #[test] -fn test_new_list_is_empty() { +fn new_list_is_empty() { let list: SimpleLinkedList = SimpleLinkedList::new(); assert_eq!(list.len(), 0, "list's length must be 0"); } #[test] #[ignore] -fn test_push_increments_length() { +fn push_increments_length() { let mut list: SimpleLinkedList = SimpleLinkedList::new(); list.push(1); assert_eq!(list.len(), 1, "list's length must be 1"); @@ -18,7 +18,7 @@ fn test_push_increments_length() { #[test] #[ignore] -fn test_pop_decrements_length() { +fn pop_decrements_length() { let mut list: SimpleLinkedList = SimpleLinkedList::new(); list.push(1); list.push(2); @@ -30,7 +30,7 @@ fn test_pop_decrements_length() { #[test] #[ignore] -fn test_is_empty() { +fn is_empty() { let mut list: SimpleLinkedList = SimpleLinkedList::new(); assert!(list.is_empty(), "List wasn't empty on creation"); for inserts in 0..100 { @@ -57,7 +57,7 @@ fn test_is_empty() { #[test] #[ignore] -fn test_pop_returns_head_element_and_removes_it() { +fn pop_returns_head_element_and_removes_it() { let mut list: SimpleLinkedList = SimpleLinkedList::new(); list.push(1); list.push(2); @@ -68,7 +68,7 @@ fn test_pop_returns_head_element_and_removes_it() { #[test] #[ignore] -fn test_peek_returns_reference_to_head_element_but_does_not_remove_it() { +fn peek_returns_reference_to_head_element_but_does_not_remove_it() { let mut list: SimpleLinkedList = SimpleLinkedList::new(); assert_eq!(list.peek(), None, "No element should be contained in list"); list.push(2); @@ -84,7 +84,7 @@ fn test_peek_returns_reference_to_head_element_but_does_not_remove_it() { #[test] #[ignore] -fn test_from_slice() { +fn from_slice() { let mut array = vec!["1", "2", "3", "4"]; let mut list: SimpleLinkedList<_> = array.drain(..).collect(); assert_eq!(list.pop(), Some("4")); @@ -95,7 +95,7 @@ fn test_from_slice() { #[test] #[ignore] -fn test_reverse() { +fn reverse() { let mut list: SimpleLinkedList = SimpleLinkedList::new(); list.push(1); list.push(2); @@ -109,7 +109,7 @@ fn test_reverse() { #[test] #[ignore] -fn test_into_vector() { +fn into_vector() { let mut v = Vec::new(); let mut s = SimpleLinkedList::new(); for i in 1..4 { diff --git a/exercises/practice/sublist/tests/sublist.rs b/exercises/practice/sublist/tests/sublist.rs index 9653ab157..c9fb9a1b1 100644 --- a/exercises/practice/sublist/tests/sublist.rs +++ b/exercises/practice/sublist/tests/sublist.rs @@ -9,25 +9,25 @@ fn empty_equals_empty() { #[test] #[ignore] -fn test_empty_is_a_sublist_of_anything() { +fn empty_is_a_sublist_of_anything() { assert_eq!(Comparison::Sublist, sublist(&[], &['a', 's', 'd', 'f'])); } #[test] #[ignore] -fn test_anything_is_a_superlist_of_empty() { +fn anything_is_a_superlist_of_empty() { assert_eq!(Comparison::Superlist, sublist(&['a', 's', 'd', 'f'], &[])); } #[test] #[ignore] -fn test_1_is_not_2() { +fn one_is_not_two() { assert_eq!(Comparison::Unequal, sublist(&[1], &[2])); } #[test] #[ignore] -fn test_compare_larger_equal_lists() { +fn compare_larger_equal_lists() { use std::iter::repeat; let v: Vec = repeat('x').take(1000).collect(); @@ -37,7 +37,7 @@ fn test_compare_larger_equal_lists() { #[test] #[ignore] -fn test_sublist_at_start() { +fn sublist_at_start() { assert_eq!(Comparison::Sublist, sublist(&[1, 2, 3], &[1, 2, 3, 4, 5])); } diff --git a/exercises/practice/two-bucket/tests/two-bucket.rs b/exercises/practice/two-bucket/tests/two-bucket.rs index 397195aed..30346ec0d 100644 --- a/exercises/practice/two-bucket/tests/two-bucket.rs +++ b/exercises/practice/two-bucket/tests/two-bucket.rs @@ -1,7 +1,7 @@ use two_bucket::{solve, Bucket, BucketStats}; #[test] -fn test_case_1() { +fn case_1() { assert_eq!( solve(3, 5, 1, &Bucket::One), Some(BucketStats { @@ -14,7 +14,7 @@ fn test_case_1() { #[test] #[ignore] -fn test_case_2() { +fn case_2() { assert_eq!( solve(3, 5, 1, &Bucket::Two), Some(BucketStats { @@ -27,7 +27,7 @@ fn test_case_2() { #[test] #[ignore] -fn test_case_3() { +fn case_3() { assert_eq!( solve(7, 11, 2, &Bucket::One), Some(BucketStats { @@ -40,7 +40,7 @@ fn test_case_3() { #[test] #[ignore] -fn test_case_4() { +fn case_4() { assert_eq!( solve(7, 11, 2, &Bucket::Two), Some(BucketStats { diff --git a/exercises/practice/word-count/tests/word-count.rs b/exercises/practice/word-count/tests/word-count.rs index 58f1eb6ee..fdbd37f06 100644 --- a/exercises/practice/word-count/tests/word-count.rs +++ b/exercises/practice/word-count/tests/word-count.rs @@ -14,19 +14,19 @@ fn check_word_count(s: &str, pairs: &[(&str, u32)]) { } #[test] -fn test_count_one_word() { +fn count_one_word() { check_word_count("word", &[("word", 1)]); } #[test] #[ignore] -fn test_count_one_of_each() { +fn count_one_of_each() { check_word_count("one of each", &[("one", 1), ("of", 1), ("each", 1)]); } #[test] #[ignore] -fn test_count_multiple_occurrences() { +fn count_multiple_occurrences() { check_word_count( "one fish two fish red fish blue fish", &[("one", 1), ("fish", 4), ("two", 1), ("red", 1), ("blue", 1)], @@ -47,7 +47,7 @@ fn expanded_lists() { #[test] #[ignore] -fn test_ignore_punctuation() { +fn ignore_punctuation() { check_word_count( "car : carpet as java : javascript!!&@$%^&", &[ @@ -62,7 +62,7 @@ fn test_ignore_punctuation() { #[test] #[ignore] -fn test_include_numbers() { +fn include_numbers() { check_word_count( "testing, 1, 2 testing", &[("testing", 2), ("1", 1), ("2", 1)], @@ -71,7 +71,7 @@ fn test_include_numbers() { #[test] #[ignore] -fn test_normalize_case() { +fn normalize_case() { check_word_count("go Go GO Stop stop", &[("go", 3), ("stop", 2)]); } diff --git a/exercises/practice/yacht/tests/yacht.rs b/exercises/practice/yacht/tests/yacht.rs index 116b170f0..9d8c6cffd 100644 --- a/exercises/practice/yacht/tests/yacht.rs +++ b/exercises/practice/yacht/tests/yacht.rs @@ -1,203 +1,203 @@ use yacht::*; #[test] -fn test_yacht() { +fn yacht() { let expected = 50; assert_eq!(score([5, 5, 5, 5, 5], Category::Yacht), expected); } #[test] #[ignore] -fn test_not_yacht() { +fn not_yacht() { let expected = 0; assert_eq!(score([1, 3, 3, 2, 5], Category::Yacht), expected); } #[test] #[ignore] -fn test_ones() { +fn ones() { let expected = 3; assert_eq!(score([1, 1, 1, 3, 5], Category::Ones), expected); } #[test] #[ignore] -fn test_ones_out_of_order() { +fn ones_out_of_order() { let expected = 3; assert_eq!(score([3, 1, 1, 5, 1], Category::Ones), expected); } #[test] #[ignore] -fn test_no_ones() { +fn no_ones() { let expected = 0; assert_eq!(score([4, 3, 6, 5, 5], Category::Ones), expected); } #[test] #[ignore] -fn test_twos() { +fn twos() { let expected = 2; assert_eq!(score([2, 3, 4, 5, 6], Category::Twos), expected); } #[test] #[ignore] -fn test_fours() { +fn fours() { let expected = 8; assert_eq!(score([1, 4, 1, 4, 1], Category::Fours), expected); } #[test] #[ignore] -fn test_yacht_counted_as_threes() { +fn yacht_counted_as_threes() { let expected = 15; assert_eq!(score([3, 3, 3, 3, 3], Category::Threes), expected); } #[test] #[ignore] -fn test_yacht_of_3s_counted_as_fives() { +fn yacht_of_3s_counted_as_fives() { let expected = 0; assert_eq!(score([3, 3, 3, 3, 3], Category::Fives), expected); } #[test] #[ignore] -fn test_fives() { +fn fives() { let expected = 10; assert_eq!(score([1, 5, 3, 5, 3], Category::Fives), expected); } #[test] #[ignore] -fn test_sixes() { +fn sixes() { let expected = 6; assert_eq!(score([2, 3, 4, 5, 6], Category::Sixes), expected); } #[test] #[ignore] -fn test_full_house_two_small_three_big() { +fn full_house_two_small_three_big() { let expected = 16; assert_eq!(score([2, 2, 4, 4, 4], Category::FullHouse), expected); } #[test] #[ignore] -fn test_full_house_three_small_two_big() { +fn full_house_three_small_two_big() { let expected = 19; assert_eq!(score([5, 3, 3, 5, 3], Category::FullHouse), expected); } #[test] #[ignore] -fn test_two_pair_is_not_a_full_house() { +fn two_pair_is_not_a_full_house() { let expected = 0; assert_eq!(score([2, 2, 4, 4, 5], Category::FullHouse), expected); } #[test] #[ignore] -fn test_four_of_a_kind_is_not_a_full_house() { +fn four_of_a_kind_is_not_a_full_house() { let expected = 0; assert_eq!(score([1, 4, 4, 4, 4], Category::FullHouse), expected); } #[test] #[ignore] -fn test_yacht_is_not_a_full_house() { +fn yacht_is_not_a_full_house() { let expected = 0; assert_eq!(score([2, 2, 2, 2, 2], Category::FullHouse), expected); } #[test] #[ignore] -fn test_four_of_a_kind() { +fn four_of_a_kind() { let expected = 24; assert_eq!(score([6, 6, 4, 6, 6], Category::FourOfAKind), expected); } #[test] #[ignore] -fn test_yacht_can_be_scored_as_four_of_a_kind() { +fn yacht_can_be_scored_as_four_of_a_kind() { let expected = 12; assert_eq!(score([3, 3, 3, 3, 3], Category::FourOfAKind), expected); } #[test] #[ignore] -fn test_full_house_is_not_four_of_a_kind() { +fn full_house_is_not_four_of_a_kind() { let expected = 0; assert_eq!(score([3, 3, 3, 5, 5], Category::FourOfAKind), expected); } #[test] #[ignore] -fn test_little_straight() { +fn little_straight() { let expected = 30; assert_eq!(score([3, 5, 4, 1, 2], Category::LittleStraight), expected); } #[test] #[ignore] -fn test_little_straight_as_big_straight() { +fn little_straight_as_big_straight() { let expected = 0; assert_eq!(score([1, 2, 3, 4, 5], Category::BigStraight), expected); } #[test] #[ignore] -fn test_four_in_order_but_not_a_little_straight() { +fn four_in_order_but_not_a_little_straight() { let expected = 0; assert_eq!(score([1, 1, 2, 3, 4], Category::LittleStraight), expected); } #[test] #[ignore] -fn test_no_pairs_but_not_a_little_straight() { +fn no_pairs_but_not_a_little_straight() { let expected = 0; assert_eq!(score([1, 2, 3, 4, 6], Category::LittleStraight), expected); } #[test] #[ignore] -fn test_minimum_is_1_maximum_is_5_but_not_a_little_straight() { +fn minimum_is_1_maximum_is_5_but_not_a_little_straight() { let expected = 0; assert_eq!(score([1, 1, 3, 4, 5], Category::LittleStraight), expected); } #[test] #[ignore] -fn test_big_straight() { +fn big_straight() { let expected = 30; assert_eq!(score([4, 6, 2, 5, 3], Category::BigStraight), expected); } #[test] #[ignore] -fn test_big_straight_as_little_straight() { +fn big_straight_as_little_straight() { let expected = 0; assert_eq!(score([6, 5, 4, 3, 2], Category::LittleStraight), expected); } #[test] #[ignore] -fn test_no_pairs_but_not_a_big_straight() { +fn no_pairs_but_not_a_big_straight() { let expected = 0; assert_eq!(score([6, 5, 4, 3, 1], Category::BigStraight), expected); } #[test] #[ignore] -fn test_choice() { +fn choice() { let expected = 23; assert_eq!(score([3, 3, 5, 6, 6], Category::Choice), expected); } #[test] #[ignore] -fn test_yacht_as_choice() { +fn yacht_as_choice() { let expected = 10; assert_eq!(score([2, 2, 2, 2, 2], Category::Choice), expected); } diff --git a/rust-tooling/src/exercise_config.rs b/rust-tooling/src/exercise_config.rs index f8b170356..9ff9b6dae 100644 --- a/rust-tooling/src/exercise_config.rs +++ b/rust-tooling/src/exercise_config.rs @@ -86,7 +86,7 @@ pub fn get_all_exercise_paths() -> impl Iterator { } #[test] -fn test_deserialize_all() { +fn deserialize_all() { for path in get_all_concept_exercise_paths() { let config_path = format!("{path}/.meta/config.json"); let config_contents = std::fs::read_to_string(config_path).unwrap(); diff --git a/rust-tooling/src/problem_spec.rs b/rust-tooling/src/problem_spec.rs index 073b8ba97..b32bef808 100644 --- a/rust-tooling/src/problem_spec.rs +++ b/rust-tooling/src/problem_spec.rs @@ -52,7 +52,7 @@ pub fn get_canonical_data(slug: &str) -> CanonicalData { } #[test] -fn test_deserialize_canonical_data() { +fn deserialize_canonical_data() { crate::fs_utils::cd_into_repo_root(); for entry in ignore::Walk::new("problem-specifications/exercises") .filter_map(|e| e.ok()) diff --git a/rust-tooling/tests/bash_script_conventions.rs b/rust-tooling/tests/bash_script_conventions.rs index ff95feb88..38dfe19e9 100644 --- a/rust-tooling/tests/bash_script_conventions.rs +++ b/rust-tooling/tests/bash_script_conventions.rs @@ -14,7 +14,7 @@ fn for_all_scripts(f: fn(PathBuf)) { } #[test] -fn test_file_extension() { +fn file_extension() { for_all_scripts(|path| { let file_name = path.file_name().unwrap().to_str().unwrap(); @@ -31,7 +31,7 @@ fn test_file_extension() { } #[test] -fn test_snake_case_name() { +fn snake_case_name() { for_all_scripts(|path| { let file_name = path .file_name() @@ -54,7 +54,7 @@ fn test_snake_case_name() { /// Notably on nixOS and macOS, bash is not installed in `/bin/bash`. #[test] -fn test_portable_shebang() { +fn portable_shebang() { for_all_scripts(|path| { let file_name = path.file_name().unwrap().to_str().unwrap(); diff --git a/rust-tooling/tests/count_ignores.rs b/rust-tooling/tests/count_ignores.rs index 4a78d04ca..9b7349624 100644 --- a/rust-tooling/tests/count_ignores.rs +++ b/rust-tooling/tests/count_ignores.rs @@ -16,7 +16,7 @@ fn assert_one_less_ignore_than_tests(path: &str) { } #[test] -fn test_count_ignores() { +fn count_ignores() { for path in get_all_concept_exercise_paths() { assert_one_less_ignore_than_tests(&path); } diff --git a/rust-tooling/tests/difficulties.rs b/rust-tooling/tests/difficulties.rs index 18c96bc03..3808829ed 100644 --- a/rust-tooling/tests/difficulties.rs +++ b/rust-tooling/tests/difficulties.rs @@ -3,7 +3,7 @@ use exercism_tooling::track_config::TRACK_CONFIG; #[test] -fn test_difficulties_are_valid() { +fn difficulties_are_valid() { let mut difficulties = TRACK_CONFIG .exercises .concept diff --git a/rust-tooling/tests/no_authors_in_cargo_toml.rs b/rust-tooling/tests/no_authors_in_cargo_toml.rs index c8428ce34..2e312c671 100644 --- a/rust-tooling/tests/no_authors_in_cargo_toml.rs +++ b/rust-tooling/tests/no_authors_in_cargo_toml.rs @@ -3,7 +3,7 @@ use exercism_tooling::exercise_config::get_all_exercise_paths; /// The package manifest of each exercise should not contain an `authors` field. /// The authors are already specified in the track configuration. #[test] -fn test_no_authors_in_cargo_toml() { +fn no_authors_in_cargo_toml() { let cargo_toml_paths = get_all_exercise_paths().map(|p| format!("{p}/Cargo.toml")); for path in cargo_toml_paths { diff --git a/rust-tooling/tests/no_trailing_whitespace.rs b/rust-tooling/tests/no_trailing_whitespace.rs index 540c160b9..9fc3254c7 100644 --- a/rust-tooling/tests/no_trailing_whitespace.rs +++ b/rust-tooling/tests/no_trailing_whitespace.rs @@ -13,7 +13,7 @@ fn contains_trailing_whitespace(p: &Path) -> bool { } #[test] -fn test_no_trailing_whitespace() { +fn no_trailing_whitespace() { fs_utils::cd_into_repo_root(); for entry in ignore::Walk::new("./") {