job-specifier.scm 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ;;;; job-specifier.scm -- tests for (mcron job-specifier) module
  2. ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Mcron.
  5. ;;;
  6. ;;; GNU Mcron is free software: you can redistribute it and/or modify
  7. ;;; it under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation, either version 3 of the License, or
  9. ;;; (at your option) any later version.
  10. ;;;
  11. ;;; GNU Mcron is distributed in the hope that it will be useful,
  12. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
  18. (use-modules (srfi srfi-64)
  19. (mcron job-specifier))
  20. (test-begin "job-specifier")
  21. (test-equal "range: basic"
  22. '(0 1 2 3 4 5 6 7 8 9)
  23. (range 0 10))
  24. (test-equal "range: positive step"
  25. '(0 2 4 6 8)
  26. (range 0 10 2))
  27. (test-assert "range: zero step"
  28. ;; Since this behavior is undefined, only check if range doesn't crash.
  29. (range 0 5 0))
  30. (test-assert "range: negative step"
  31. ;; Since this behavior is undefined, only check if range doesn't crash.
  32. (range 0 5 -2))
  33. (test-assert "range: reverse boundaries"
  34. (range 10 3))
  35. (test-end)