|
10 | 10 |
|
11 | 11 | from cocoasm.values import NumericValue, StringValue, NoneValue, SymbolValue, \ |
12 | 12 | AddressValue, Value, ExpressionValue, ExplicitAddressingMode, LeftRightValue, \ |
13 | | - MultiByteValue |
| 13 | + MultiByteValue, MultiWordValue |
14 | 14 | from cocoasm.instruction import Instruction, Mode |
15 | 15 | from cocoasm.exceptions import ValueTypeError |
16 | 16 |
|
@@ -280,7 +280,7 @@ def test_numeric_negative_int_value_get_negative_correct_16_bit(self): |
280 | 280 |
|
281 | 281 | class TestMultiByteValue(unittest.TestCase): |
282 | 282 | """ |
283 | | - A test class for the StringValue class. |
| 283 | + A test class for the MultiByteValue class. |
284 | 284 | """ |
285 | 285 | def setUp(self): |
286 | 286 | """ |
@@ -317,6 +317,45 @@ def test_multi_byte_16_bit_correct(self): |
317 | 317 | self.assertFalse(result.is_16_bit()) |
318 | 318 |
|
319 | 319 |
|
| 320 | +class TestMultiWordValue(unittest.TestCase): |
| 321 | + """ |
| 322 | + A test class for the StringValue class. |
| 323 | + """ |
| 324 | + def setUp(self): |
| 325 | + """ |
| 326 | + Common setup routines needed for all unit tests. |
| 327 | + """ |
| 328 | + pass |
| 329 | + |
| 330 | + def test_multi_word_raises_on_no_delimiter(self): |
| 331 | + with self.assertRaises(ValueTypeError) as context: |
| 332 | + MultiWordValue('$DEAD') |
| 333 | + self.assertEqual("multi-word declarations must have a comma in them", str(context.exception)) |
| 334 | + |
| 335 | + def test_multi_word_no_values_correct(self): |
| 336 | + result = MultiWordValue(",") |
| 337 | + self.assertEqual("", result.hex()) |
| 338 | + self.assertEqual(0, result.hex_len()) |
| 339 | + |
| 340 | + def test_multi_word_single_value_correct(self): |
| 341 | + result = MultiWordValue("$DEAD,") |
| 342 | + self.assertEqual("DEAD", result.hex()) |
| 343 | + self.assertEqual(4, result.hex_len()) |
| 344 | + |
| 345 | + def test_multi_word_many_values_correct(self): |
| 346 | + result = MultiWordValue("$DEAD,$BEEF") |
| 347 | + self.assertEqual("DEADBEEF", result.hex()) |
| 348 | + self.assertEqual(8, result.hex_len()) |
| 349 | + |
| 350 | + def test_multi_byte_8_bit_correct(self): |
| 351 | + result = MultiWordValue("$DEAD,$BEEF") |
| 352 | + self.assertFalse(result.is_8_bit()) |
| 353 | + |
| 354 | + def test_multi_byte_16_bit_correct(self): |
| 355 | + result = MultiWordValue("$DEAD,$BEEF") |
| 356 | + self.assertFalse(result.is_16_bit()) |
| 357 | + |
| 358 | + |
320 | 359 | class TestStringValue(unittest.TestCase): |
321 | 360 | """ |
322 | 361 | A test class for the StringValue class. |
|
0 commit comments