list-helpers-test.scm 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. (use-modules
  2. ;; SRFI 64 for unit testing facilities
  3. (srfi srfi-64)
  4. ;; utils - the code to be tested
  5. ((helpers list-helpers)))
  6. (test-begin "list-helpers-test")
  7. (test-group
  8. "longest-sublist-length-test"
  9. (test-eqv 0 (longest-sublist-length
  10. '()))
  11. (test-eqv 7 (longest-sublist-length
  12. '((1 2 3 4 5 6 (a b c d (e) f g h))
  13. (a)
  14. (b c d (1 2 3 4 5) e)
  15. (c)
  16. (d e f))))
  17. (test-eqv 6 (longest-sublist-length
  18. '((1 2 3 4 5 6)
  19. (a)
  20. (b c d (1 2 3 4 5) e)
  21. (c)
  22. (d e f))))
  23. (test-eqv 5 (longest-sublist-length
  24. '((a)
  25. (b c d (1 2 3 4 5) e)
  26. (c)
  27. (d e f)))))
  28. (test-group
  29. "dimensionality-test"
  30. (test-eqv 0 (dimendionality
  31. '()))
  32. (test-eqv 1 (dimendionality
  33. '(1 2 3)))
  34. (test-eqv 2 (dimendionality
  35. '((1 2) (3 4))))
  36. (test-eqv 3 (dimendionality
  37. '(1 2 (34 5 6) 3 (4 5 (3 ())))))
  38. (test-eqv 3 (dimendionality
  39. '(1 2 (34 5 6 ()) 3 (4 5 (3 ())))))
  40. (test-eqv 3 (dimendionality
  41. '(1 2 (34 5 6 (213)) 3 (4 5 (3 ())))))
  42. (test-eqv 3 (dimendionality
  43. '(1 2 (34 5 6 (213 ())) 3 (4 5 (3 ())))))
  44. (test-eqv 4 (dimendionality
  45. '(1 2 (34 5 6 (213 (1))) 3 (4 5 (3 ()))))))
  46. (test-end "list-helpers-test")