Skip to content

Commit

Permalink
Update resistor-color-duo tests (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras authored Mar 27, 2024
1 parent f50f29b commit e52e88b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions exercises/practice/resistor-color-duo/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
14 changes: 14 additions & 0 deletions exercises/practice/resistor-color-duo/source/resistor_color_duo.d
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}

}

0 comments on commit e52e88b

Please sign in to comment.