Skip to content

Commit 6eb8367

Browse files
committed
Change to actual and expected format
1 parent 3e82c0d commit 6eb8367

6 files changed

Lines changed: 16 additions & 7 deletions

File tree

exercises/practice/pig-latin/.meta/test_template.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ class PigLatinTest < Minitest::Test
66
<% cases["cases"].each do |sub_case|%>
77
def test_<%= underscore(sub_case["description"]) %>
88
<%= skip? %>
9-
assert_equal '<%= sub_case["expected"] %>', PigLatin.translate('<%= sub_case["input"]["phrase"] %>')
9+
actual = PigLatin.translate('<%= sub_case["input"]["phrase"] %>')
10+
expected = '<%= sub_case["expected"] %>'
11+
assert_equal expected, actual
1012
end
1113
<% end%>
1214
<% end %>

exercises/practice/poker/.meta/test_template.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ class PokerTest < Minitest::Test
55
<% json["cases"].each do |cases| %>
66
def test_<%= underscore(cases["description"]) %>
77
<%= skip? %>
8-
hands = [<%= cases["input"]["hands"].map{ |hand| "%w[#{hand}]"}.join(", ") %>]
9-
assert_equal [<%= cases["expected"].map{ |hand| "%w[#{hand}]"}.join(", ") %>], Poker.new(hands).best_hand
8+
actual = [<%= cases["input"]["hands"].map{ |hand| "%w[#{hand}]"}.join(", ") %>]
9+
expected = [<%= cases["expected"].map{ |hand| "%w[#{hand}]"}.join(", ") %>]
10+
assert_equal expected, actual
1011
end
1112
<% end %>
1213
end

exercises/practice/prime-factors/.meta/test_template.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ class PrimeFactorsTest < Minitest::Test
55
<% json["cases"].each do |cases| %>
66
def test_<%= underscore(cases["description"]) %>
77
<%= skip? %>
8-
assert_equal <%= cases["expected"] %>, PrimeFactors.of(<%= cases["input"]["value"] %>)
8+
actual = PrimeFactors.of(<%= cases["input"]["value"] %>)
9+
expected = <%= cases["expected"] %>
10+
assert_equal expected, actual
911
end
1012
<% end %>
1113
end

exercises/practice/protein-translation/.meta/test_template.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ class ProteinTranslationTest < Minitest::Test
1111
Translation.of_rna(strand)
1212
end
1313
<%- else -%>
14+
actual = Translation.of_rna(strand)
1415
expected = %w[<%= cases["expected"].join(" ") %>]
15-
assert_equal expected, Translation.of_rna(strand)
16+
assert_equal expected, actual
1617
<%- end -%>
1718
end
1819
<% end %>

exercises/practice/pythagorean-triplet/.meta/test_template.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ class PythagoreanTripletTest < Minitest::Test
55
<% json["cases"].each do |cases| %>
66
def test_<%= underscore(cases["description"]) %>
77
<%= skip? %>
8+
actual = PythagoreanTriplet.triplets_with_sum(<%= cases["input"]["n"] %>)
89
expected = <%= cases["expected"] %>
9-
assert_equal expected, PythagoreanTriplet.triplets_with_sum(<%= cases["input"]["n"] %>)
10+
assert_equal expected, actual
1011
end
1112
<% end %>
1213
end

exercises/practice/rail-fence-cipher/.meta/test_template.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ class RailFenceCipherTest < Minitest::Test
66
<% cases["cases"].each do |sub_case| %>
77
def test_<%= underscore(sub_case["description"]) %>
88
<%= skip? %>
9-
assert_equal '<%= sub_case["expected"] %>', RailFenceCipher.<%= sub_case["property"] %>('<%= sub_case["input"]["msg"] %>', <%= sub_case["input"]["rails"] %>)
9+
actual = RailFenceCipher.<%= sub_case["property"] %>('<%= sub_case["input"]["msg"] %>', <%= sub_case["input"]["rails"] %>)
10+
expected = '<%= sub_case["expected"] %>'
11+
assert_equal expected, actual
1012
end
1113
<% end %>
1214
<% end %>

0 commit comments

Comments
 (0)