data-point-test.scm 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. (use-modules
  2. ;; SRFI 64 for unit testing facilities
  3. (srfi srfi-64)
  4. ;; Utilities for testing
  5. #;(test-utils)
  6. ;; Dependencies for testing the code to be tested
  7. (data-point))
  8. (test-begin "data-point-test")
  9. (test-group
  10. "make-data-point"
  11. (test-equal "make-data-point-1"
  12. #(a 1 2 3)
  13. (make-data-point 'a 1 2 3)))
  14. (test-group
  15. "data-point-length"
  16. (test-equal "data-point-length-1"
  17. 5
  18. (data-point-length #(0.1 0.2 0.3245 123.213432 'a))))
  19. (test-group
  20. "data-point-get-col"
  21. (test-equal "data-point-get-col-1"
  22. (data-point-get-col #(0 32 478 282 1) 1)
  23. 32)
  24. (test-equal "data-point-get-col-2"
  25. (data-point-get-col #(0 32 478 282 1) 0)
  26. 0))
  27. (test-group
  28. "data-point-set-col!"
  29. (let ([a-data-point (make-data-point 0 32 478 282 1)])
  30. (data-point-set-col! a-data-point 1 64)
  31. (test-equal "data-point-set-col!-1"
  32. a-data-point
  33. (make-data-point 0 64 478 282 1))))
  34. (test-group
  35. "data-point-take"
  36. (test-equal "data-point-take-1"
  37. (make-data-point 'a 'b 'c 100)
  38. (data-point-take (make-data-point 'a 'b 'c 100 30 1) 4)))
  39. (test-group
  40. "data-point-take-features"
  41. (test-equal
  42. #(0 1 2 3)
  43. (data-point-take-features #(0 1 2 3 4) 4))
  44. (test-equal
  45. #(10 9 8)
  46. (data-point-take-features #(10 9 8 4) 3)))
  47. (test-end "data-point-test")