-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync raindrops with problem-specifications (#1786)
[no important files changed]
- Loading branch information
Showing
3 changed files
with
166 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% for test in cases %} | ||
#[test] | ||
{% if loop.index != 1 -%} | ||
#[ignore] | ||
{% endif -%} | ||
fn test_{{ test.description | slugify | replace(from="-", to="_") }}() { | ||
let input = {{ test.input.number | json_encode() }}; | ||
let output = {{ crate_name }}::{{ fn_names[0] }}(input); | ||
let expected = {{ test.expected | json_encode() }}; | ||
assert_eq!(output, expected); | ||
} | ||
{% endfor -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,64 @@ | ||
# This is an auto-generated file. Regular comments will be removed when this | ||
# file is regenerated. Regenerating will not touch any manually added keys, | ||
# so comments can be added in a "comment" key. | ||
# This is an auto-generated file. | ||
# | ||
# Regenerating this file via `configlet sync` will: | ||
# - Recreate every `description` key/value pair | ||
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications | ||
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) | ||
# - Preserve any other key/value pair | ||
# | ||
# As user-added comments (using the # character) will be removed when this file | ||
# is regenerated, comments can be added via a `comment` key. | ||
|
||
[1575d549-e502-46d4-a8e1-6b7bec6123d8] | ||
description = "the sound for 1 is 1" | ||
|
||
[1f51a9f9-4895-4539-b182-d7b0a5ab2913] | ||
description = "the sound for 3 is Pling" | ||
|
||
[2d9bfae5-2b21-4bcd-9629-c8c0e388f3e0] | ||
description = "the sound for 5 is Plang" | ||
|
||
[d7e60daa-32ef-4c23-b688-2abff46c4806] | ||
description = "the sound for 7 is Plong" | ||
|
||
[6bb4947b-a724-430c-923f-f0dc3d62e56a] | ||
description = "the sound for 6 is Pling as it has a factor 3" | ||
|
||
[ce51e0e8-d9d4-446d-9949-96eac4458c2d] | ||
description = "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" | ||
|
||
[0dd66175-e3e2-47fc-8750-d01739856671] | ||
description = "the sound for 9 is Pling as it has a factor 3" | ||
|
||
[022c44d3-2182-4471-95d7-c575af225c96] | ||
description = "the sound for 10 is Plang as it has a factor 5" | ||
|
||
[37ab74db-fed3-40ff-b7b9-04acdfea8edf] | ||
description = "the sound for 14 is Plong as it has a factor of 7" | ||
|
||
[31f92999-6afb-40ee-9aa4-6d15e3334d0f] | ||
description = "the sound for 15 is PlingPlang as it has factors 3 and 5" | ||
|
||
[ff9bb95d-6361-4602-be2c-653fe5239b54] | ||
description = "the sound for 21 is PlingPlong as it has factors 3 and 7" | ||
|
||
[d2e75317-b72e-40ab-8a64-6734a21dece1] | ||
description = "the sound for 25 is Plang as it has a factor 5" | ||
|
||
[a09c4c58-c662-4e32-97fe-f1501ef7125c] | ||
description = "the sound for 27 is Pling as it has a factor 3" | ||
|
||
[bdf061de-8564-4899-a843-14b48b722789] | ||
description = "the sound for 35 is PlangPlong as it has factors 5 and 7" | ||
|
||
[c4680bee-69ba-439d-99b5-70c5fd1a7a83] | ||
description = "the sound for 49 is Plong as it has a factor 7" | ||
|
||
[17f2bc9a-b65a-4d23-8ccd-266e8c271444] | ||
description = "the sound for 52 is 52" | ||
|
||
[e46677ed-ff1a-419f-a740-5c713d2830e4] | ||
description = "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" | ||
|
||
[13c6837a-0fcd-4b86-a0eb-20572f7deb0b] | ||
description = "the sound for 3125 is Plang as it has a factor 5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,160 @@ | ||
#[test] | ||
fn test_1() { | ||
assert_eq!("1", raindrops::raindrops(1)); | ||
fn test_the_sound_for_1_is_1() { | ||
let input = 1; | ||
let output = raindrops::raindrops(input); | ||
let expected = "1"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_3() { | ||
assert_eq!("Pling", raindrops::raindrops(3)); | ||
fn test_the_sound_for_3_is_pling() { | ||
let input = 3; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Pling"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_5() { | ||
assert_eq!("Plang", raindrops::raindrops(5)); | ||
fn test_the_sound_for_5_is_plang() { | ||
let input = 5; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Plang"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_7() { | ||
assert_eq!("Plong", raindrops::raindrops(7)); | ||
fn test_the_sound_for_7_is_plong() { | ||
let input = 7; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Plong"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_6() { | ||
assert_eq!("Pling", raindrops::raindrops(6)); | ||
fn test_the_sound_for_6_is_pling_as_it_has_a_factor_3() { | ||
let input = 6; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Pling"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_8() { | ||
assert_eq!("8", raindrops::raindrops(8)); | ||
fn test_2_to_the_power_3_does_not_make_a_raindrop_sound_as_3_is_the_exponent_not_the_base() { | ||
let input = 8; | ||
let output = raindrops::raindrops(input); | ||
let expected = "8"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_9() { | ||
assert_eq!("Pling", raindrops::raindrops(9)); | ||
fn test_the_sound_for_9_is_pling_as_it_has_a_factor_3() { | ||
let input = 9; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Pling"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_10() { | ||
assert_eq!("Plang", raindrops::raindrops(10)); | ||
fn test_the_sound_for_10_is_plang_as_it_has_a_factor_5() { | ||
let input = 10; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Plang"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_14() { | ||
assert_eq!("Plong", raindrops::raindrops(14)); | ||
fn test_the_sound_for_14_is_plong_as_it_has_a_factor_of_7() { | ||
let input = 14; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Plong"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_15() { | ||
assert_eq!("PlingPlang", raindrops::raindrops(15)); | ||
fn test_the_sound_for_15_is_plingplang_as_it_has_factors_3_and_5() { | ||
let input = 15; | ||
let output = raindrops::raindrops(input); | ||
let expected = "PlingPlang"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_21() { | ||
assert_eq!("PlingPlong", raindrops::raindrops(21)); | ||
fn test_the_sound_for_21_is_plingplong_as_it_has_factors_3_and_7() { | ||
let input = 21; | ||
let output = raindrops::raindrops(input); | ||
let expected = "PlingPlong"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_25() { | ||
assert_eq!("Plang", raindrops::raindrops(25)); | ||
fn test_the_sound_for_25_is_plang_as_it_has_a_factor_5() { | ||
let input = 25; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Plang"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_27() { | ||
assert_eq!("Pling", raindrops::raindrops(27)); | ||
fn test_the_sound_for_27_is_pling_as_it_has_a_factor_3() { | ||
let input = 27; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Pling"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_35() { | ||
assert_eq!("PlangPlong", raindrops::raindrops(35)); | ||
fn test_the_sound_for_35_is_plangplong_as_it_has_factors_5_and_7() { | ||
let input = 35; | ||
let output = raindrops::raindrops(input); | ||
let expected = "PlangPlong"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_49() { | ||
assert_eq!("Plong", raindrops::raindrops(49)); | ||
fn test_the_sound_for_49_is_plong_as_it_has_a_factor_7() { | ||
let input = 49; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Plong"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_52() { | ||
assert_eq!("52", raindrops::raindrops(52)); | ||
fn test_the_sound_for_52_is_52() { | ||
let input = 52; | ||
let output = raindrops::raindrops(input); | ||
let expected = "52"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_105() { | ||
assert_eq!("PlingPlangPlong", raindrops::raindrops(105)); | ||
fn test_the_sound_for_105_is_plingplangplong_as_it_has_factors_3_5_and_7() { | ||
let input = 105; | ||
let output = raindrops::raindrops(input); | ||
let expected = "PlingPlangPlong"; | ||
assert_eq!(output, expected); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_3125() { | ||
assert_eq!("Plang", raindrops::raindrops(3125)); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_12121() { | ||
assert_eq!("12121", raindrops::raindrops(12_121)); | ||
fn test_the_sound_for_3125_is_plang_as_it_has_a_factor_5() { | ||
let input = 3125; | ||
let output = raindrops::raindrops(input); | ||
let expected = "Plang"; | ||
assert_eq!(output, expected); | ||
} |