diff --git a/exercises/practice/resistor-color-duo/.meta/tests.toml b/exercises/practice/resistor-color-duo/.meta/tests.toml index 5b5e59a3..9036fc78 100644 --- a/exercises/practice/resistor-color-duo/.meta/tests.toml +++ b/exercises/practice/resistor-color-duo/.meta/tests.toml @@ -18,8 +18,14 @@ description = "Blue and grey" [f1886361-fdfd-4693-acf8-46726fe24e0c] description = "Yellow and violet" +[b7a6cbd2-ae3c-470a-93eb-56670b305640] +description = "White and red" + [77a8293d-2a83-4016-b1af-991acc12b9fe] description = "Orange and orange" [0c4fb44f-db7c-4d03-afa8-054350f156a8] description = "Ignore additional colors" + +[4a8ceec5-0ab4-4904-88a4-daf953a5e818] +description = "Black and brown, one-digit" diff --git a/exercises/practice/resistor-color-duo/source/resistor_color_duo.d b/exercises/practice/resistor-color-duo/source/resistor_color_duo.d index e592decf..3ec7338d 100644 --- a/exercises/practice/resistor-color-duo/source/resistor_color_duo.d +++ b/exercises/practice/resistor-color-duo/source/resistor_color_duo.d @@ -1,5 +1,13 @@ module resistor_color_duo; +class ResistorColorDuo +{ + static pure long value(immutable string[] colorsInput) + { + // implement this function + } +} + unittest { immutable int allTestsEnabled = 0; @@ -15,11 +23,17 @@ unittest // Yellow and violet assert(ResistorColorDuo.value(["yellow", "violet"]) == 47); + // White and red + assert(ResistorColorDuo.value(["white", "red"]) == 92); + // Orange and orange assert(ResistorColorDuo.value(["orange", "orange"]) == 33); // Ignore additional colors assert(ResistorColorDuo.value(["green", "brown", "orange"]) == 51); + + // Black and brown, one-digit + assert(ResistorColorDuo.value(["black", "brown"]) == 1); } }