Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update resistor-color-duo tests #226

Merged
merged 1 commit into from
Mar 27, 2024
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
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);
}

}