PageRenderTime 26ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/beer-song/test/beer_song_test.clj

https://gitlab.com/lucacervello/exercism-clojure
Clojure | 47 lines | 39 code | 8 blank | 0 comment | 6 complexity | 1330cef296d0a9d39c0f0e5f6b088db1 MD5 | raw file
  1. (ns beer-song-test
  2. (:require [clojure.test :refer [deftest is]]
  3. beer-song))
  4. (def verse-8
  5. (str "8 bottles of beer on the wall, 8 bottles of beer.\n"
  6. "Take one down and pass it around, 7 bottles of beer on the wall.\n"))
  7. (def verse-2
  8. (str "2 bottles of beer on the wall, 2 bottles of beer.\n"
  9. "Take one down and pass it around, 1 bottle of beer on the wall.\n"))
  10. (def verse-1
  11. (str "1 bottle of beer on the wall, 1 bottle of beer.\n"
  12. "Take it down and pass it around, no more bottles of beer on the wall.\n"))
  13. (def verse-0
  14. (str "No more bottles of beer on the wall, no more bottles of beer.\n"
  15. "Go to the store and buy some more, 99 bottles of beer on the wall.\n"))
  16. (def song-8-6
  17. (str "8 bottles of beer on the wall, 8 bottles of beer.\n"
  18. "Take one down and pass it around, 7 bottles of beer on the wall.\n\n"
  19. "7 bottles of beer on the wall, 7 bottles of beer.\n"
  20. "Take one down and pass it around, 6 bottles of beer on the wall.\n\n"
  21. "6 bottles of beer on the wall, 6 bottles of beer.\n"
  22. "Take one down and pass it around, 5 bottles of beer on the wall.\n"))
  23. (def song-3-0
  24. (str "3 bottles of beer on the wall, 3 bottles of beer.\n"
  25. "Take one down and pass it around, 2 bottles of beer on the wall.\n\n"
  26. "2 bottles of beer on the wall, 2 bottles of beer.\n"
  27. "Take one down and pass it around, 1 bottle of beer on the wall.\n\n"
  28. "1 bottle of beer on the wall, 1 bottle of beer.\n"
  29. "Take it down and pass it around, no more bottles of beer on the wall.\n\n"
  30. "No more bottles of beer on the wall, no more bottles of beer.\n"
  31. "Go to the store and buy some more, 99 bottles of beer on the wall.\n"))
  32. (deftest test-verse
  33. (is (= verse-8 (beer-song/verse 8)))
  34. (is (= verse-2 (beer-song/verse 2)))
  35. (is (= verse-1 (beer-song/verse 1)))
  36. (is (= verse-0 (beer-song/verse 0))))
  37. (deftest test-song
  38. (is (= song-8-6 (beer-song/sing 8 6)))
  39. (is (= song-3-0 (beer-song/sing 3))))