|
| 1 | +FoodChain = require 'food_chain' |
| 2 | + |
| 3 | +describe 'food-chain', -> |
| 4 | + it 'fly', -> |
| 5 | + result = FoodChain.recite 1, 1 |
| 6 | + expected = {'I know an old lady who swallowed a fly.', "I don't know why she swallowed the fly. Perhaps she'll die."} |
| 7 | + assert.are.equal table.concat(expected, "\n"), result |
| 8 | + |
| 9 | + pending 'spider', -> |
| 10 | + result = FoodChain.recite 2, 2 |
| 11 | + expected = { |
| 12 | + 'I know an old lady who swallowed a spider.', |
| 13 | + 'It wriggled and jiggled and tickled inside her.', |
| 14 | + 'She swallowed the spider to catch the fly.', |
| 15 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 16 | + } |
| 17 | + assert.are.equal table.concat(expected, "\n"), result |
| 18 | + |
| 19 | + pending 'bird', -> |
| 20 | + result = FoodChain.recite 3, 3 |
| 21 | + expected = { |
| 22 | + 'I know an old lady who swallowed a bird.', |
| 23 | + 'How absurd to swallow a bird!', |
| 24 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 25 | + 'She swallowed the spider to catch the fly.', |
| 26 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 27 | + } |
| 28 | + assert.are.equal table.concat(expected, "\n"), result |
| 29 | + |
| 30 | + pending 'cat', -> |
| 31 | + result = FoodChain.recite 4, 4 |
| 32 | + expected = { |
| 33 | + 'I know an old lady who swallowed a cat.', |
| 34 | + 'Imagine that, to swallow a cat!', |
| 35 | + 'She swallowed the cat to catch the bird.', |
| 36 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 37 | + 'She swallowed the spider to catch the fly.', |
| 38 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 39 | + } |
| 40 | + assert.are.equal table.concat(expected, "\n"), result |
| 41 | + |
| 42 | + pending 'dog', -> |
| 43 | + result = FoodChain.recite 5, 5 |
| 44 | + expected = { |
| 45 | + 'I know an old lady who swallowed a dog.', |
| 46 | + 'What a hog, to swallow a dog!', |
| 47 | + 'She swallowed the dog to catch the cat.', |
| 48 | + 'She swallowed the cat to catch the bird.', |
| 49 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 50 | + 'She swallowed the spider to catch the fly.', |
| 51 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 52 | + } |
| 53 | + assert.are.equal table.concat(expected, "\n"), result |
| 54 | + |
| 55 | + pending 'goat', -> |
| 56 | + result = FoodChain.recite 6, 6 |
| 57 | + expected = { |
| 58 | + 'I know an old lady who swallowed a goat.', |
| 59 | + 'Just opened her throat and swallowed a goat!', |
| 60 | + 'She swallowed the goat to catch the dog.', |
| 61 | + 'She swallowed the dog to catch the cat.', |
| 62 | + 'She swallowed the cat to catch the bird.', |
| 63 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 64 | + 'She swallowed the spider to catch the fly.', |
| 65 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 66 | + } |
| 67 | + assert.are.equal table.concat(expected, "\n"), result |
| 68 | + |
| 69 | + pending 'cow', -> |
| 70 | + result = FoodChain.recite 7, 7 |
| 71 | + expected = { |
| 72 | + 'I know an old lady who swallowed a cow.', |
| 73 | + "I don't know how she swallowed a cow!", |
| 74 | + 'She swallowed the cow to catch the goat.', |
| 75 | + 'She swallowed the goat to catch the dog.', |
| 76 | + 'She swallowed the dog to catch the cat.', |
| 77 | + 'She swallowed the cat to catch the bird.', |
| 78 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 79 | + 'She swallowed the spider to catch the fly.', |
| 80 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 81 | + } |
| 82 | + assert.are.equal table.concat(expected, "\n"), result |
| 83 | + |
| 84 | + pending 'horse', -> |
| 85 | + result = FoodChain.recite 8, 8 |
| 86 | + expected = {'I know an old lady who swallowed a horse.', "She's dead, of course!"} |
| 87 | + assert.are.equal table.concat(expected, "\n"), result |
| 88 | + |
| 89 | + pending 'multiple verses', -> |
| 90 | + result = FoodChain.recite 1, 3 |
| 91 | + expected = { |
| 92 | + 'I know an old lady who swallowed a fly.', |
| 93 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 94 | + '', |
| 95 | + 'I know an old lady who swallowed a spider.', |
| 96 | + 'It wriggled and jiggled and tickled inside her.', |
| 97 | + 'She swallowed the spider to catch the fly.', |
| 98 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 99 | + '', |
| 100 | + 'I know an old lady who swallowed a bird.', |
| 101 | + 'How absurd to swallow a bird!', |
| 102 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 103 | + 'She swallowed the spider to catch the fly.', |
| 104 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 105 | + } |
| 106 | + assert.are.equal table.concat(expected, "\n"), result |
| 107 | + |
| 108 | + pending 'full song', -> |
| 109 | + result = FoodChain.recite 1, 8 |
| 110 | + expected = { |
| 111 | + 'I know an old lady who swallowed a fly.', |
| 112 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 113 | + '', |
| 114 | + 'I know an old lady who swallowed a spider.', |
| 115 | + 'It wriggled and jiggled and tickled inside her.', |
| 116 | + 'She swallowed the spider to catch the fly.', |
| 117 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 118 | + '', |
| 119 | + 'I know an old lady who swallowed a bird.', |
| 120 | + 'How absurd to swallow a bird!', |
| 121 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 122 | + 'She swallowed the spider to catch the fly.', |
| 123 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 124 | + '', |
| 125 | + 'I know an old lady who swallowed a cat.', |
| 126 | + 'Imagine that, to swallow a cat!', |
| 127 | + 'She swallowed the cat to catch the bird.', |
| 128 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 129 | + 'She swallowed the spider to catch the fly.', |
| 130 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 131 | + '', |
| 132 | + 'I know an old lady who swallowed a dog.', |
| 133 | + 'What a hog, to swallow a dog!', |
| 134 | + 'She swallowed the dog to catch the cat.', |
| 135 | + 'She swallowed the cat to catch the bird.', |
| 136 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 137 | + 'She swallowed the spider to catch the fly.', |
| 138 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 139 | + '', |
| 140 | + 'I know an old lady who swallowed a goat.', |
| 141 | + 'Just opened her throat and swallowed a goat!', |
| 142 | + 'She swallowed the goat to catch the dog.', |
| 143 | + 'She swallowed the dog to catch the cat.', |
| 144 | + 'She swallowed the cat to catch the bird.', |
| 145 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 146 | + 'She swallowed the spider to catch the fly.', |
| 147 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 148 | + '', |
| 149 | + 'I know an old lady who swallowed a cow.', |
| 150 | + "I don't know how she swallowed a cow!", |
| 151 | + 'She swallowed the cow to catch the goat.', |
| 152 | + 'She swallowed the goat to catch the dog.', |
| 153 | + 'She swallowed the dog to catch the cat.', |
| 154 | + 'She swallowed the cat to catch the bird.', |
| 155 | + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.', |
| 156 | + 'She swallowed the spider to catch the fly.', |
| 157 | + "I don't know why she swallowed the fly. Perhaps she'll die.", |
| 158 | + '', |
| 159 | + 'I know an old lady who swallowed a horse.', |
| 160 | + "She's dead, of course!", |
| 161 | + } |
| 162 | + assert.are.equal table.concat(expected, "\n"), result |
0 commit comments