Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions exercises/concept/csv-builder/tests/csv-builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use csv_builder::*;

#[test]
fn test_no_escaping() {
fn no_escaping() {
let mut builder = CsvRecordBuilder::new();

builder.add("ant");
Expand All @@ -15,7 +15,7 @@ fn test_no_escaping() {

#[test]
#[ignore]
fn test_quote() {
fn quote() {
let mut builder = CsvRecordBuilder::new();

builder.add("ant");
Expand All @@ -28,7 +28,7 @@ fn test_quote() {

#[test]
#[ignore]
fn test_new_line() {
fn new_line() {
let mut builder = CsvRecordBuilder::new();

builder.add("ant");
Expand All @@ -39,7 +39,7 @@ fn test_new_line() {
}
#[test]
#[ignore]
fn test_comma() {
fn comma() {
let mut builder = CsvRecordBuilder::new();

builder.add("ant");
Expand All @@ -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());
Expand Down
10 changes: 5 additions & 5 deletions exercises/concept/health-statistics/tests/health-statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions exercises/concept/magazine-cutout/tests/magazine-cutout.rs
Original file line number Diff line number Diff line change
@@ -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::<Vec<&str>>();
Expand All @@ -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::<Vec<&str>>();
let note = "give one grand today."
.split_whitespace()
Expand All @@ -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::<Vec<&str>>();
Expand All @@ -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::<Vec<&str>>();
Expand All @@ -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::<Vec<&str>>();
Expand All @@ -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::<Vec<&str>>();
let note = "A nice day".split_whitespace().collect::<Vec<&str>>();
assert!(!can_construct_note(&magazine, &note));
Expand Down
16 changes: 8 additions & 8 deletions exercises/concept/resistor-color/tests/resistor-color.rs
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -46,7 +46,7 @@ fn test_11_out_of_range() {

#[test]
#[ignore]
fn test_all_colors() {
fn all_colors() {
use ResistorColor::*;
assert_eq!(
colors(),
Expand Down
16 changes: 8 additions & 8 deletions exercises/concept/role-playing-game/tests/role-playing-game.rs
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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,
Expand All @@ -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),
Expand All @@ -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,
Expand All @@ -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;
Expand All @@ -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),
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
22 changes: 11 additions & 11 deletions exercises/concept/rpn-calculator/tests/rpn-calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,77 +13,77 @@ fn calculator_input(s: &str) -> Vec<CalculatorInput> {
}

#[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);
}
8 changes: 5 additions & 3 deletions exercises/concept/short-fibonacci/tests/short-fibonacci.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Loading