The Rules
Write a function that takes in an integer number and displays the proper verse from the song “99 Bottles of Beer on the Wall”.
Most lyrics fit this format:
99 bottles of beer on the wall,\n
99 bottles of beer.\n
Take one down and pass it around,\n
98 bottles of beer on the wall.\n
There are a few exceptions:
6 bottles of beer are called 1 six-pack
From 2 to 1 bottles, the plural has to be correct:
1 bottle of beer on the wall.\n
The final lyric is as follows:
1 bottle of beer on the wall,\n
1 bottle of beer.\n
Take it down and pass it around,\n
no more bottles of beer on the wall.\n
Starting API
fun verse(number: Int): String
First Test
@Test
fun `base case lyrics 99 bottles`() = runTest {
val expected = """99 bottles of beer on the wall,
|99 bottles of beer.
|Take one down and pass it around
|98 bottles of beer on the wall.
|""".trimMargin()
assertEquals(expected, verse(99))
}