|
| 1 | +module main |
| 2 | + |
| 3 | +fn test_zero_pieces() { |
| 4 | + strings := []string{} |
| 5 | + expected := '' |
| 6 | + assert recite(strings) == expected |
| 7 | +} |
| 8 | + |
| 9 | +fn test_one_piece() { |
| 10 | + strings := ['nail'] |
| 11 | + expected := ('And all for the want of a nail.') |
| 12 | + assert recite(strings) == expected |
| 13 | +} |
| 14 | + |
| 15 | +fn test_two_pieces() { |
| 16 | + strings := ['nail', 'shoe'] |
| 17 | + expected := ('For want of a nail the shoe was lost. |
| 18 | +And all for the want of a nail.') |
| 19 | + assert recite(strings) == expected |
| 20 | +} |
| 21 | + |
| 22 | +fn test_three_pieces() { |
| 23 | + strings := ['nail', 'shoe', 'horse'] |
| 24 | + expected := ('For want of a nail the shoe was lost. |
| 25 | +For want of a shoe the horse was lost. |
| 26 | +And all for the want of a nail.') |
| 27 | + assert recite(strings) == expected |
| 28 | +} |
| 29 | + |
| 30 | +fn test_full_proverb() { |
| 31 | + strings := ['nail', 'shoe', 'horse', 'rider', 'message', 'battle', 'kingdom'] |
| 32 | + expected := ('For want of a nail the shoe was lost. |
| 33 | +For want of a shoe the horse was lost. |
| 34 | +For want of a horse the rider was lost. |
| 35 | +For want of a rider the message was lost. |
| 36 | +For want of a message the battle was lost. |
| 37 | +For want of a battle the kingdom was lost. |
| 38 | +And all for the want of a nail.') |
| 39 | + assert recite(strings) == expected |
| 40 | +} |
| 41 | + |
| 42 | +fn test_four_pieces_modernized() { |
| 43 | + strings := ['pin', 'gun', 'soldier', 'battle'] |
| 44 | + expected := ('For want of a pin the gun was lost. |
| 45 | +For want of a gun the soldier was lost. |
| 46 | +For want of a soldier the battle was lost. |
| 47 | +And all for the want of a pin.') |
| 48 | + assert recite(strings) == expected |
| 49 | +} |
0 commit comments