|
| 1 | +module main |
| 2 | + |
| 3 | +fn test_verse__single_verse__first_generic_verse() { |
| 4 | + expected := |
| 5 | +("Ten green bottles hanging on the wall, |
| 6 | +Ten green bottles hanging on the wall, |
| 7 | +And if one green bottle should accidentally fall, |
| 8 | +There'll be nine green bottles hanging on the wall.") |
| 9 | + assert recite(10, 1) == expected |
| 10 | +} |
| 11 | + |
| 12 | +fn test_verse__single_verse__last_generic_verse() { |
| 13 | + expected := |
| 14 | +("Three green bottles hanging on the wall, |
| 15 | +Three green bottles hanging on the wall, |
| 16 | +And if one green bottle should accidentally fall, |
| 17 | +There'll be two green bottles hanging on the wall.") |
| 18 | + assert recite(3, 1) == expected |
| 19 | +} |
| 20 | + |
| 21 | +fn test_verse__single_verse__verse_with_2_bottles() { |
| 22 | + expected := |
| 23 | +("Two green bottles hanging on the wall, |
| 24 | +Two green bottles hanging on the wall, |
| 25 | +And if one green bottle should accidentally fall, |
| 26 | +There'll be one green bottle hanging on the wall.") |
| 27 | + assert recite(2, 1) == expected |
| 28 | +} |
| 29 | + |
| 30 | +fn test_verse__single_verse__verse_with_1_bottle() { |
| 31 | + expected := |
| 32 | +("One green bottle hanging on the wall, |
| 33 | +One green bottle hanging on the wall, |
| 34 | +And if one green bottle should accidentally fall, |
| 35 | +There'll be no green bottles hanging on the wall.") |
| 36 | + assert recite(1, 1) == expected |
| 37 | +} |
| 38 | + |
| 39 | +fn test_lyrics__multiple_verses__first_two_verses() { |
| 40 | + expected := |
| 41 | +("Ten green bottles hanging on the wall, |
| 42 | +Ten green bottles hanging on the wall, |
| 43 | +And if one green bottle should accidentally fall, |
| 44 | +There'll be nine green bottles hanging on the wall. |
| 45 | +
|
| 46 | +Nine green bottles hanging on the wall, |
| 47 | +Nine green bottles hanging on the wall, |
| 48 | +And if one green bottle should accidentally fall, |
| 49 | +There'll be eight green bottles hanging on the wall.") |
| 50 | + assert recite(10, 2) == expected |
| 51 | +} |
| 52 | + |
| 53 | +fn test_lyrics__multiple_verses__last_three_verses() { |
| 54 | + expected := |
| 55 | +("Three green bottles hanging on the wall, |
| 56 | +Three green bottles hanging on the wall, |
| 57 | +And if one green bottle should accidentally fall, |
| 58 | +There'll be two green bottles hanging on the wall. |
| 59 | +
|
| 60 | +Two green bottles hanging on the wall, |
| 61 | +Two green bottles hanging on the wall, |
| 62 | +And if one green bottle should accidentally fall, |
| 63 | +There'll be one green bottle hanging on the wall. |
| 64 | +
|
| 65 | +One green bottle hanging on the wall, |
| 66 | +One green bottle hanging on the wall, |
| 67 | +And if one green bottle should accidentally fall, |
| 68 | +There'll be no green bottles hanging on the wall.") |
| 69 | + assert recite(3, 3) == expected |
| 70 | +} |
| 71 | + |
| 72 | +fn test_lyrics__multiple_verses__all_verses() { |
| 73 | + expected := |
| 74 | +("Ten green bottles hanging on the wall, |
| 75 | +Ten green bottles hanging on the wall, |
| 76 | +And if one green bottle should accidentally fall, |
| 77 | +There'll be nine green bottles hanging on the wall. |
| 78 | +
|
| 79 | +Nine green bottles hanging on the wall, |
| 80 | +Nine green bottles hanging on the wall, |
| 81 | +And if one green bottle should accidentally fall, |
| 82 | +There'll be eight green bottles hanging on the wall. |
| 83 | +
|
| 84 | +Eight green bottles hanging on the wall, |
| 85 | +Eight green bottles hanging on the wall, |
| 86 | +And if one green bottle should accidentally fall, |
| 87 | +There'll be seven green bottles hanging on the wall. |
| 88 | +
|
| 89 | +Seven green bottles hanging on the wall, |
| 90 | +Seven green bottles hanging on the wall, |
| 91 | +And if one green bottle should accidentally fall, |
| 92 | +There'll be six green bottles hanging on the wall. |
| 93 | +
|
| 94 | +Six green bottles hanging on the wall, |
| 95 | +Six green bottles hanging on the wall, |
| 96 | +And if one green bottle should accidentally fall, |
| 97 | +There'll be five green bottles hanging on the wall. |
| 98 | +
|
| 99 | +Five green bottles hanging on the wall, |
| 100 | +Five green bottles hanging on the wall, |
| 101 | +And if one green bottle should accidentally fall, |
| 102 | +There'll be four green bottles hanging on the wall. |
| 103 | +
|
| 104 | +Four green bottles hanging on the wall, |
| 105 | +Four green bottles hanging on the wall, |
| 106 | +And if one green bottle should accidentally fall, |
| 107 | +There'll be three green bottles hanging on the wall. |
| 108 | +
|
| 109 | +Three green bottles hanging on the wall, |
| 110 | +Three green bottles hanging on the wall, |
| 111 | +And if one green bottle should accidentally fall, |
| 112 | +There'll be two green bottles hanging on the wall. |
| 113 | +
|
| 114 | +Two green bottles hanging on the wall, |
| 115 | +Two green bottles hanging on the wall, |
| 116 | +And if one green bottle should accidentally fall, |
| 117 | +There'll be one green bottle hanging on the wall. |
| 118 | +
|
| 119 | +One green bottle hanging on the wall, |
| 120 | +One green bottle hanging on the wall, |
| 121 | +And if one green bottle should accidentally fall, |
| 122 | +There'll be no green bottles hanging on the wall.") |
| 123 | + assert recite(10, 10) == expected |
| 124 | +} |
0 commit comments