diff --git a/unit-testing.html b/unit-testing.html index 3198cfc..73c5e70 100755 --- a/unit-testing.html +++ b/unit-testing.html @@ -570,9 +570,9 @@ OK result = roman5.from_roman(numeral) self.assertEqual(integer, result) -

There’s a pleasing symmetry here. The to_roman() and from_roman() functions are inverses of each other. The first converts integers to specially-formatted strings, the second converts specially-formated strings to integers. In theory, we should be able to “round-trip” a number by passing to the to_roman() function to get a string, then passing that string to the from_roman() function to get an integer, and end up with the same number. In mathematical terms, +

There’s a pleasing symmetry here. The to_roman() and from_roman() functions are inverses of each other. The first converts integers to specially-formatted strings, the second converts specially-formated strings to integers. In theory, we should be able to “round-trip” a number by passing to the to_roman() function to get a string, then passing that string to the from_roman() function to get an integer, and end up with the same number. -

x = f(g(x)) for all values of x
+
n = from_roman(to_roman(n)) for all values of n

In this case, “all values” means any number between 1..3999, since that is the valid range of inputs to the to_roman() function. We can express this symmetry in a test case that runs through all the values 1..3999, calls to_roman(), calls from_roman(), and checks that the output is the same as the original input. @@ -652,7 +652,7 @@ FAILED (failures=2) """convert Roman numeral to integer""" result = 0 index = 0 - for numeral, integer in romanNumeralMap: + for numeral, integer in roman_numeral_map: while s[index:index+len(numeral)] == numeral: result += integer index += len(numeral) @@ -667,7 +667,7 @@ FAILED (failures=2) """convert Roman numeral to integer""" result = 0 index = 0 - for numeral, integer in romanNumeralMap: + for numeral, integer in roman_numeral_map: while s[index:index+len(numeral)] == numeral: result += integer index += len(numeral)