AboutSummaryRefsLogTreeCommitDiffStats
path: root/tests/job-specifier.scm
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-05-10 01:06:10 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-12-01 00:15:55 +0100
commit9d173e23bc0bf39c1114f2ac6fc6e5c1e56dd55f (patch)
tree3a6a3d719e4da61b3943f27f8c5c08c31eab2f5a /tests/job-specifier.scm
parentc9064dde98b2a91be6c9f23c37168c7468fd873f (diff)
downloadmcron-9d173e23bc0bf39c1114f2ac6fc6e5c1e56dd55f.tar.gz
mcron-9d173e23bc0bf39c1114f2ac6fc6e5c1e56dd55f.tar.bz2
mcron-9d173e23bc0bf39c1114f2ac6fc6e5c1e56dd55f.zip
job-specifier: range: Add tests.
* build-aux/test-driver.scm: New script. * configure.ac (AC_REQUIRE_AUX_FILE): Add it. * tests/job-specifier.scm: New test. * Makefile.am (TEST_EXTENSIONS, AM_TESTS_ENVIRONMENT, SCM_LOG_DRIVER) (TESTS): New variables. (EXTRA_DIST): Update. * .gitignore: Likewise.
Diffstat (limited to 'tests/job-specifier.scm')
-rw-r--r--tests/job-specifier.scm43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/job-specifier.scm b/tests/job-specifier.scm
new file mode 100644
index 0000000..889530b
--- /dev/null
+++ b/tests/job-specifier.scm
@@ -0,0 +1,43 @@
+;;;; job-specifier.scm -- tests for (mcron job-specifier) module
+;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
+;;;
+;;; This file is part of GNU Mcron.
+;;;
+;;; GNU Mcron is free software: you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; GNU Mcron is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
+
+(use-modules (srfi srfi-64)
+ (mcron job-specifier))
+
+(test-begin "job-specifier")
+
+(test-equal "range: basic"
+ '(0 1 2 3 4 5 6 7 8 9)
+ (range 0 10))
+
+(test-equal "range: positive step"
+ '(0 2 4 6 8)
+ (range 0 10 2))
+
+(test-assert "range: zero step"
+ ;; Since this behavior is undefined, only check if range doesn't crash.
+ (range 0 5 0))
+
+(test-assert "range: negative step"
+ ;; Since this behavior is undefined, only check if range doesn't crash.
+ (range 0 5 -2))
+
+(test-assert "range: reverse boundaries"
+ (range 10 3))
+
+(test-end)