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

Swap actual and expected values in tests #66

Merged
merged 1 commit into from
May 18, 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
26 changes: 13 additions & 13 deletions exercises/practice/darts/darts_test.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,88 @@ func test_missed_target(solution_script):
var x = -9
var y = 9
var expected = 0
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_on_the_outer_circle(solution_script):
var x = 0
var y = 10
var expected = 1
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_on_the_middle_circle(solution_script):
var x = -5
var y = 0
var expected = 5
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_on_the_inner_circle(solution_script):
var x = 0
var y = -1
var expected = 10
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_exactly_on_center(solution_script):
var x = 0
var y = 0
var expected = 10
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_near_the_center(solution_script):
var x = -0.1
var y = -0.1
var expected = 10
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_just_within_the_inner_circle(solution_script):
var x = 0.7
var y = 0.7
var expected = 10
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_just_outside_the_inner_circle(solution_script):
var x = 0.8
var y = -0.8
var expected = 5
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_just_within_the_middle_circle(solution_script):
var x = -3.5
var y = 3.5
var expected = 5
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_just_outside_the_middle_circle(solution_script):
var x = -3.6
var y = -3.6
var expected = 1
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_just_within_the_outer_circle(solution_script):
var x = -7.0
var y = 7.0
var expected = 1
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_just_outside_the_outer_circle(solution_script):
var x = 7.1
var y = -7.1
var expected = 0
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]


func test_asymmetric_position(solution_script):
var x = 0.5
var y = -4
var expected = 5
return [expected, solution_script.score(x, y)]
return [solution_script.score(x, y), expected]
2 changes: 1 addition & 1 deletion exercises/practice/hello-world/hello_world_test.gd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
func test_hello_world(solution_script):
return ["Hello, World!", solution_script.hello()]
return [solution_script.hello(), "Hello, World!"]
18 changes: 9 additions & 9 deletions exercises/practice/leap/leap_test.gd
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
func test_year_not_divisible_by_4(solution_script):
return [false, solution_script.leap(2015)]
return [solution_script.leap(2015), false]


func test_year_divisible_by_2_not_4(solution_script):
return [false, solution_script.leap(1970)]
return [solution_script.leap(1970), false]


func test_year_divisible_by_4_not_100(solution_script):
return [true, solution_script.leap(1996)]
return [solution_script.leap(1996), true]


func test_year_divisible_by_4_and_5(solution_script):
return [true, solution_script.leap(1960)]
return [solution_script.leap(1960), true]


func test_year_divisible_by_100_not_400(solution_script):
return [false, solution_script.leap(2100)]
return [solution_script.leap(2100), false]


func test_year_divisible_by_100_not_3(solution_script):
return [false, solution_script.leap(1900)]
return [solution_script.leap(1900), false]


func test_year_divisible_by_400(solution_script):
return [true, solution_script.leap(2000)]
return [solution_script.leap(2000), true]


func test_year_divisible_by_400_not_125(solution_script):
return [true, solution_script.leap(2400)]
return [solution_script.leap(2400), true]


func test_year_divisible_by_200_not_400(solution_script):
return [false, solution_script.leap(1800)]
return [ solution_script.leap(1800), false]
20 changes: 10 additions & 10 deletions exercises/practice/pangram/pangram_test.gd
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
func test_empty_sentence(solution_script):
var input = ""
var expected = false
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_perfect_lower_case(solution_script):
var input = "abcdefghijklmnopqrstuvwxyz"
var expected = true
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_the_quick_brown_fox_jumps_over_the_lazy_dog(solution_script):
var input = "the quick brown fox jumps over the lazy dog"
var expected = true
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_missing_the_letter_x(solution_script):
var input = "a quick movement of the enemy will jeopardize five gunboats"
var expected = false
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_missing_the_letter_h(solution_script):
var input = "five boxing wizards jump quickly at it"
var expected = false
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_with_underscores(solution_script):
var input = "the_quick_brown_fox_jumps_over_the_lazy_dog"
var expected = true
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_with_numbers(solution_script):
var input = "the 1 quick brown fox jumps over the 2 lazy dogs"
var expected = true
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]

func test_missing_letters_replaced_by_numbers(solution_script):
var input = "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"
var expected = false
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_mixed_case_and_punctuation(solution_script):
var input = "\"Five quacking Zephyrs jolt my wax bed.\""
var expected = true
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]


func test_case_insensitive(solution_script):
var input = "abcdefghijklm ABCDEFGHIJKLM"
var expected = false
return [expected, solution_script.is_pangram(input)]
return [solution_script.is_pangram(input), expected]
14 changes: 7 additions & 7 deletions exercises/practice/resistor-color-duo/resistor_color_duo_test.gd
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
func test_brown_and_black(solution_script):
var colors = ["brown", "black"]
var expected = 10
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_blue_and_grey(solution_script):
var colors = ["blue", "grey"]
var expected = 68
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_yellow_and_violet(solution_script):
var colors = ["yellow", "violet"]
var expected = 47
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_white_and_red(solution_script):
var colors = ["white", "red"]
var expected = 92
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_orange_and_orange(solution_script):
var colors = ["orange", "orange"]
var expected = 33
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_ignore_additional_colors(solution_script):
var colors = ["green", "brown", "orange"]
var expected = 51
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_black_and_brown_one_digit(solution_script):
var colors = ["black", "brown"]
var expected = 1
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
func test_orange_orange_black_and_red(solution_script):
var colors = ["orange", "orange", "black", "red"]
var expected = "33 ohms ±2%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_blue_grey_brown_and_violet(solution_script):
var colors = ["blue", "grey", "brown", "violet"]
var expected = "680 ohms ±0.1%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_red_black_red_and_green(solution_script):
var colors = ["red", "black", "red", "green"]
var expected = "2 kiloohms ±0.5%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_green_brown_orange_and_grey(solution_script):
var colors = ["green", "brown", "orange", "grey"]
var expected = "51 kiloohms ±0.05%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_one_black_band(solution_script):
var colors = ["black"]
var expected = "0 ohms"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_orange_orange_yellow_black_and_brown(solution_script):
var colors = ["orange", "orange", "yellow", "black", "brown"]
var expected = "334 ohms ±1%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_red_green_yellow_yellow_and_brown(solution_script):
var colors = ["red", "green", "yellow", "yellow", "brown"]
var expected = "2.54 megaohms ±1%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_blue_grey_white_red_and_brown(solution_script):
var colors = ["blue", "grey", "white", "brown", "brown"]
var expected = "6.89 kiloohms ±1%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_violet_orange_red_and_grey(solution_script):
var colors = ["violet", "orange", "red", "grey"]
var expected = "7.3 kiloohms ±0.05%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]


func test_brown_red_orange_green_and_blue(solution_script):
var colors = ["brown", "red", "orange", "green", "blue"]
var expected = "12.3 megaohms ±0.25%"
return [expected, solution_script.color_code(colors)]
return [solution_script.color_code(colors), expected]

Loading