Skip to content
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
2 changes: 1 addition & 1 deletion exercises/practice/isogram/.meta/template.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% for case in cases %}
func test_{{ case.func_name }}(solution_script):
var got = solution_script.is_isogram("{{ case.given }}")
var want = {{ case.expected }}
var want = {{ case.expected | quote }}
return [got, want]

{% endfor %}
Expand Down
28 changes: 14 additions & 14 deletions exercises/practice/isogram/isogram_test.gd
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
func test_empty_string(solution_script):
var got = solution_script.is_isogram("")
var want = True
var want = true
return [got, want]


func test_isogram_with_only_lower_case_characters(solution_script):
var got = solution_script.is_isogram("isogram")
var want = True
var want = true
return [got, want]


func test_word_with_one_duplicated_character(solution_script):
var got = solution_script.is_isogram("eleven")
var want = False
var want = false
return [got, want]


func test_word_with_one_duplicated_character_from_the_end_of_the_alphabet(solution_script):
var got = solution_script.is_isogram("zzyzx")
var want = False
var want = false
return [got, want]


func test_longest_reported_english_isogram(solution_script):
var got = solution_script.is_isogram("subdermatoglyphic")
var want = True
var want = true
return [got, want]


func test_word_with_duplicated_character_in_mixed_case(solution_script):
var got = solution_script.is_isogram("Alphabet")
var want = False
var want = false
return [got, want]


func test_word_with_duplicated_character_in_mixed_case_lowercase_first(solution_script):
var got = solution_script.is_isogram("alphAbet")
var want = False
var want = false
return [got, want]


func test_hypothetical_isogrammic_word_with_hyphen(solution_script):
var got = solution_script.is_isogram("thumbscrew-japingly")
var want = True
var want = true
return [got, want]


func test_hypothetical_word_with_duplicated_character_following_hyphen(solution_script):
var got = solution_script.is_isogram("thumbscrew-jappingly")
var want = False
var want = false
return [got, want]


func test_isogram_with_duplicated_hyphen(solution_script):
var got = solution_script.is_isogram("six-year-old")
var want = True
var want = true
return [got, want]


func test_made_up_name_that_is_an_isogram(solution_script):
var got = solution_script.is_isogram("Emily Jung Schwartzkopf")
var want = True
var want = true
return [got, want]


func test_duplicated_character_in_the_middle(solution_script):
var got = solution_script.is_isogram("accentor")
var want = False
var want = false
return [got, want]


func test_same_first_and_last_characters(solution_script):
var got = solution_script.is_isogram("angola")
var want = False
var want = false
return [got, want]


func test_word_with_duplicated_character_and_with_two_hyphens(solution_script):
var got = solution_script.is_isogram("up-to-date")
var want = False
var want = false
return [got, want]
2 changes: 1 addition & 1 deletion exercises/practice/leap/.meta/template.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% for case in cases %}
func test_{{ case.func_name }}(solution_script):
var got = solution_script.leap({{ case.given }})
var want = {{ case.expected }}
var want = {{ case.expected | quote }}
return [got, want]

{% endfor %}
Expand Down
18 changes: 9 additions & 9 deletions exercises/practice/leap/leap_test.gd
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
func test_year_not_divisible_by_4_in_common_year(solution_script):
var got = solution_script.leap(2015)
var want = False
var want = false
return [got, want]


func test_year_divisible_by_2_not_divisible_by_4_in_common_year(solution_script):
var got = solution_script.leap(1970)
var want = False
var want = false
return [got, want]


func test_year_divisible_by_4_not_divisible_by_100_in_leap_year(solution_script):
var got = solution_script.leap(1996)
var want = True
var want = true
return [got, want]


func test_year_divisible_by_4_and_5_is_still_a_leap_year(solution_script):
var got = solution_script.leap(1960)
var want = True
var want = true
return [got, want]


func test_year_divisible_by_100_not_divisible_by_400_in_common_year(solution_script):
var got = solution_script.leap(2100)
var want = False
var want = false
return [got, want]


func test_year_divisible_by_100_but_not_by_3_is_still_not_a_leap_year(solution_script):
var got = solution_script.leap(1900)
var want = False
var want = false
return [got, want]


func test_year_divisible_by_400_is_leap_year(solution_script):
var got = solution_script.leap(2000)
var want = True
var want = true
return [got, want]


func test_year_divisible_by_400_but_not_by_125_is_still_a_leap_year(solution_script):
var got = solution_script.leap(2400)
var want = True
var want = true
return [got, want]


func test_year_divisible_by_200_not_divisible_by_400_in_common_year(solution_script):
var got = solution_script.leap(1800)
var want = False
var want = false
return [got, want]
2 changes: 1 addition & 1 deletion exercises/practice/luhn/.meta/template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
func test_{{ case.func_name }}(solution_script):
solution_script.card_num = "{{ case.given }}"
var got = solution_script.{{ case.property }}()
var want = {{ case.expected }}
var want = {{ case.expected | quote }}
return [got, want]

{% endfor %}
Expand Down
44 changes: 22 additions & 22 deletions exercises/practice/luhn/luhn_test.gd
Original file line number Diff line number Diff line change
@@ -1,154 +1,154 @@
func test_single_digit_strings_can_not_be_valid(solution_script):
solution_script.card_num = "1"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_a_single_zero_is_invalid(solution_script):
solution_script.card_num = "0"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_a_simple_valid_sin_that_remains_valid_if_reversed(solution_script):
solution_script.card_num = "059"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_a_simple_valid_sin_that_becomes_invalid_if_reversed(solution_script):
solution_script.card_num = "59"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_a_valid_canadian_sin(solution_script):
solution_script.card_num = "055 444 285"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_invalid_canadian_sin(solution_script):
solution_script.card_num = "055 444 286"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_invalid_credit_card(solution_script):
solution_script.card_num = "8273 1232 7352 0569"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_invalid_long_number_with_an_even_remainder(solution_script):
solution_script.card_num = "1 2345 6789 1234 5678 9012"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_invalid_long_number_with_a_remainder_divisible_by_5(solution_script):
solution_script.card_num = "1 2345 6789 1234 5678 9013"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_valid_number_with_an_even_number_of_digits(solution_script):
solution_script.card_num = "095 245 88"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_valid_number_with_an_odd_number_of_spaces(solution_script):
solution_script.card_num = "234 567 891 234"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_valid_strings_with_a_non_digit_added_at_the_end_become_invalid(solution_script):
solution_script.card_num = "059a"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_valid_strings_with_punctuation_included_become_invalid(solution_script):
solution_script.card_num = "055-444-285"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_valid_strings_with_symbols_included_become_invalid(solution_script):
solution_script.card_num = "055# 444$ 285"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_single_zero_with_space_is_invalid(solution_script):
solution_script.card_num = " 0"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_more_than_a_single_zero_is_valid(solution_script):
solution_script.card_num = "0000 0"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_input_digit_9_is_correctly_converted_to_output_digit_9(solution_script):
solution_script.card_num = "091"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_very_long_input_is_valid(solution_script):
solution_script.card_num = "9999999999 9999999999 9999999999 9999999999"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_valid_luhn_with_an_odd_number_of_digits_and_non_zero_first_digit(solution_script):
solution_script.card_num = "109"
var got = solution_script.valid()
var want = True
var want = true
return [got, want]


func test_using_ascii_value_for_non_doubled_non_digit_isn_t_allowed(solution_script):
solution_script.card_num = "055b 444 285"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_using_ascii_value_for_doubled_non_digit_isn_t_allowed(solution_script):
solution_script.card_num = ":9"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


func test_non_numeric_non_space_char_in_the_middle_with_a_sum_that_s_divisible_by_10_isn_t_allowed(solution_script):
solution_script.card_num = "59%59"
var got = solution_script.valid()
var want = False
var want = false
return [got, want]


Expand Down
Loading