33from forth import evaluate , StackUnderflowError
44
55
6- # Tests adapted from `problem-specifications//canonical-data.json` @ v1.6 .0
6+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.7 .0
77
88class ForthUtilities (unittest .TestCase ):
99 # Utility functions
@@ -133,12 +133,12 @@ def test_errors_if_there_is_nothing_on_the_stack(self):
133133
134134class ForthDropTest (ForthUtilities ):
135135 def test_removes_the_top_value_on_the_stack_if_it_is_the_only_one (self ):
136- input_data = ["1 DROP " ]
136+ input_data = ["1 drop " ]
137137 expected = []
138138 self .assertEqual (evaluate (input_data ), expected )
139139
140140 def test_removes_the_top_value_on_the_stack_if_it_not_the_only_one (self ):
141- input_data = ["3 4 DROP " ]
141+ input_data = ["3 4 drop " ]
142142 expected = [3 ]
143143 self .assertEqual (evaluate (input_data ), expected )
144144
@@ -150,12 +150,12 @@ def test_errors_if_there_is_nothing_on_the_stack(self):
150150
151151class ForthSwapTest (ForthUtilities ):
152152 def test_swaps_only_two_values_on_stack (self ):
153- input_data = ["1 2 SWAP " ]
153+ input_data = ["1 2 swap " ]
154154 expected = [2 , 1 ]
155155 self .assertEqual (evaluate (input_data ), expected )
156156
157157 def test_swaps_two_two_values_on_stack (self ):
158- input_data = ["1 2 3 SWAP " ]
158+ input_data = ["1 2 3 swap " ]
159159 expected = [1 , 3 , 2 ]
160160 self .assertEqual (evaluate (input_data ), expected )
161161
@@ -172,12 +172,12 @@ def test_errors_if_there_is_only_one_value_on_the_stack(self):
172172
173173class ForthOverTest (ForthUtilities ):
174174 def test_copies_the_second_element_if_there_are_only_two (self ):
175- input_data = ["1 2 OVER " ]
175+ input_data = ["1 2 over " ]
176176 expected = [1 , 2 , 1 ]
177177 self .assertEqual (evaluate (input_data ), expected )
178178
179179 def test_copies_the_second_element_if_there_are_more_than_two (self ):
180- input_data = ["1 2 3 OVER " ]
180+ input_data = ["1 2 3 over " ]
181181 expected = [1 , 2 , 3 , 2 ]
182182 self .assertEqual (evaluate (input_data ), expected )
183183
0 commit comments