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
7 changes: 7 additions & 0 deletions exercises/practice/atbash-cipher/.meta/template.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% for case in cases %}
func test_{{ case["func_name"] }}(solution_script):
var got = solution_script.{{ case["property"] }}("{{ case["input"]["phrase"] }}")
var want = "{{ case["expected"] }}"
return [got, want]

{% endfor %}
69 changes: 42 additions & 27 deletions exercises/practice/atbash-cipher/atbash_cipher_test.gd
Original file line number Diff line number Diff line change
@@ -1,67 +1,82 @@
func test_encode_yes(solution_script):
return [solution_script.encode("yes"), "bvh"]
var got = solution_script.encode("yes")
var want = "bvh"
return [got, want]


func test_encode_no(solution_script):
return [solution_script.encode("no"), "ml"]
var got = solution_script.encode("no")
var want = "ml"
return [got, want]


func test_encode_omg(solution_script):
return [solution_script.encode("OMG"), "lnt"]
var got = solution_script.encode("OMG")
var want = "lnt"
return [got, want]


func test_encode_spaces(solution_script):
return [solution_script.encode("O M G"), "lnt"]
var got = solution_script.encode("O M G")
var want = "lnt"
return [got, want]


func test_encode_mindblowingly(solution_script):
return [solution_script.encode("mindblowingly"), "nrmwy oldrm tob"]
var got = solution_script.encode("mindblowingly")
var want = "nrmwy oldrm tob"
return [got, want]


func test_encode_numbers(solution_script):
return [solution_script.encode("Testing,1 2 3, testing."), "gvhgr mt123 gvhgr mt"]
var got = solution_script.encode("Testing,1 2 3, testing.")
var want = "gvhgr mt123 gvhgr mt"
return [got, want]


func test_encode_deep_thought(solution_script):
return [solution_script.encode("Truth is fiction."), "gifgs rhurx grlm"]
var got = solution_script.encode("Truth is fiction.")
var want = "gifgs rhurx grlm"
return [got, want]


func test_encode_all_the_letters(solution_script):
return [
solution_script.encode("The quick brown fox jumps over the lazy dog."),
"gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt",
]
var got = solution_script.encode("The quick brown fox jumps over the lazy dog.")
var want = "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"
return [got, want]


func test_decode_exercism(solution_script):
return [solution_script.decode("vcvix rhn"), "exercism"]
var got = solution_script.decode("vcvix rhn")
var want = "exercism"
return [got, want]


func test_decode_a_sentence(solution_script):
return [
solution_script.decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v"),
"anobstacleisoftenasteppingstone",
]
var got = solution_script.decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v")
var want = "anobstacleisoftenasteppingstone"
return [got, want]


func test_decode_numbers(solution_script):
return [solution_script.decode("gvhgr mt123 gvhgr mt"), "testing123testing"]
var got = solution_script.decode("gvhgr mt123 gvhgr mt")
var want = "testing123testing"
return [got, want]


func test_decode_all_the_letters(solution_script):
return [
solution_script.decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"),
"thequickbrownfoxjumpsoverthelazydog",
]
var got = solution_script.decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")
var want = "thequickbrownfoxjumpsoverthelazydog"
return [got, want]


func test_decode_with_too_many_spaces(solution_script):
return [solution_script.decode("vc vix r hn"), "exercism"]
var got = solution_script.decode("vc vix r hn")
var want = "exercism"
return [got, want]


func test_decode_with_no_spaces(solution_script):
return [
solution_script.decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv"), "anobstacleisoftenasteppingstone"
]


var got = solution_script.decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv")
var want = "anobstacleisoftenasteppingstone"
return [got, want]
Loading