From 3cbd1b567c287d6b1d4b1d0422d3dbccaab2c0f8 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Sun, 23 Nov 2014 18:29:46 -0800 Subject: [PATCH] Introduce ambiguity in Hamming problem. This removes the tests that define behavior for cases where the strings are of unequal length. Since the hamming problem is the first one on the Ruby track, and so many people who are new to programming start with the Ruby track, I didn't want to introduce error handling here. The wikipedia article about the Hamming distance says that the behavior is undefined if the strings are of unequal length. I don't necessarily think that this means that a particular implementation _shouldn't_ specify an error, only that it's OK to leave it undefined. This will also make it possible to bring up the idea of edge cases and error handling in the discussions on the site. Closes #44 and #31. --- hamming/hamming_test.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hamming/hamming_test.rb b/hamming/hamming_test.rb index ef1355a2fb..69768e676c 100644 --- a/hamming/hamming_test.rb +++ b/hamming/hamming_test.rb @@ -32,16 +32,6 @@ def test_small_hamming_distance_in_longer_strand assert_equal 1, Hamming.compute('GGACG', 'GGTCG') end - def test_ignores_extra_length_on_first_strand_when_longer - skip - assert_equal 1, Hamming.compute('AGAGACTTA', 'AAA') - end - - def test_ignores_extra_length_on_other_strand_when_longer - skip - assert_equal 2, Hamming.compute('AGG', 'AAAACTGACCCACCCCAGG') - end - def test_large_hamming_distance skip assert_equal 4, Hamming.compute('GATACA', 'GCATAA')