string-utils-test.scm 824 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. (use-modules
  2. ;; SRFI 64 for unit testing facilities
  3. (srfi srfi-64)
  4. (utils string-utils))
  5. (test-begin "string-utils-test")
  6. (test-group
  7. "stringify"
  8. (test-equal "stringify-positive-number"
  9. "1"
  10. (stringify 1))
  11. (test-equal "stringify-negative-number"
  12. "-1"
  13. (stringify -1))
  14. (test-equal "stringify-string-remains-the-same"
  15. "123"
  16. (stringify "123"))
  17. (test-equal "stringify-float"
  18. "3.14"
  19. (stringify 3.14))
  20. (test-equal "stringify-other"
  21. "ab1"
  22. (stringify 'ab1)))
  23. (test-group
  24. "n-times-string"
  25. (test-equal "n-times-string-1"
  26. "ababab"
  27. (n-times-string "ab" 3))
  28. (test-equal "n-times-string-2"
  29. "ab\nab\n"
  30. (n-times-string "ab\n" 2))
  31. (test-equal "n-times-string with 0 times the string should be empty string"
  32. ""
  33. (n-times-string "ab\n" 0)))
  34. (test-end "string-utils-test")