|
| 1 | +func test_orange_and_orange_and_black(solution_script): |
| 2 | + var colors = ["orange", "orange", "black"] |
| 3 | + var expected = "33 ohms" |
| 4 | + return [expected, solution_script.color_code(colors)] |
| 5 | + |
| 6 | + |
| 7 | +func test_blue_and_grey_and_brown(solution_script): |
| 8 | + var colors = ["blue", "grey", "brown"] |
| 9 | + var expected = "680 ohms" |
| 10 | + return [expected, solution_script.color_code(colors)] |
| 11 | + |
| 12 | + |
| 13 | +func test_red_and_black_and_red(solution_script): |
| 14 | + var colors = ["red", "black", "red"] |
| 15 | + var expected = "2 kiloohms" |
| 16 | + return [expected, solution_script.color_code(colors)] |
| 17 | + |
| 18 | + |
| 19 | +func test_green_and_brown_and_orange(solution_script): |
| 20 | + var colors = ["green", "brown", "orange"] |
| 21 | + var expected = "51 kiloohms" |
| 22 | + return [expected, solution_script.color_code(colors)] |
| 23 | + |
| 24 | + |
| 25 | +func test_yellow_and_violet_and_yellow(solution_script): |
| 26 | + var colors = ["yellow", "violet", "yellow"] |
| 27 | + var expected = "470 kiloohms" |
| 28 | + return [expected, solution_script.color_code(colors)] |
| 29 | + |
| 30 | + |
| 31 | +func test_blue_and_violet_and_blue(solution_script): |
| 32 | + var colors = ["blue", "violet", "blue"] |
| 33 | + var expected = "67 megaohms" |
| 34 | + return [expected, solution_script.color_code(colors)] |
| 35 | + |
| 36 | + |
| 37 | +func test_minimum_possible_value(solution_script): |
| 38 | + var colors = ["black", "black", "black"] |
| 39 | + var expected = "0 ohms" |
| 40 | + return [expected, solution_script.color_code(colors)] |
| 41 | + |
| 42 | + |
| 43 | +func test_maximum_possible_value(solution_script): |
| 44 | + var colors = ["white", "white", "white"] |
| 45 | + var expected = "99 gigaohms" |
| 46 | + return [expected, solution_script.color_code(colors)] |
| 47 | + |
| 48 | + |
| 49 | +func test_first_two_colors_make_an_invalid_octal_number(solution_script): |
| 50 | + var colors = ["black", "grey", "black"] |
| 51 | + var expected = "8 ohms" |
| 52 | + return [expected, solution_script.color_code(colors)] |
| 53 | + |
| 54 | + |
| 55 | +func test_ignore_extra_colors(solution_script): |
| 56 | + var colors = ["blue", "green", "yellow", "orange"] |
| 57 | + var expected = "650 kiloohms" |
| 58 | + return [expected, solution_script.color_code(colors)] |
| 59 | + |
0 commit comments