AboutSummaryRefsLogTreeCommitDiffStats
path: root/tests
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2018-03-24 14:03:54 +0100
committerMathieu Lirzin <mthl@gnu.org>2018-03-24 14:03:54 +0100
commit526ce502e5b7bce1e3577696b2c41564f7248920 (patch)
tree9d00520d17f296c3a7544bb11281e1c5f6f3fb19 /tests
parentd63db1ce4e8b30459bd3e67da619531f2741f9bf (diff)
downloadmcron-526ce502e5b7bce1e3577696b2c41564f7248920.tar.gz
mcron-526ce502e5b7bce1e3577696b2c41564f7248920.tar.bz2
mcron-526ce502e5b7bce1e3577696b2c41564f7248920.zip
base: Box 'number-children'
* src/mcron/base.scm (number-children): Box it using SRFI-111 to be explicit about the mutability of this object. (update-number-children!): New procedure. (run-job, child-cleanup): Use it. * tests/base.scm ("update-number-children!: 1+") ("number-children: init", "update-number-children!: 1-"): New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/base.scm32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/base.scm b/tests/base.scm
index 89b7349..d7a2dbd 100644
--- a/tests/base.scm
+++ b/tests/base.scm
@@ -17,6 +17,7 @@
;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
(use-modules (srfi srfi-64)
+ (srfi srfi-111)
(mcron base))
(test-begin "base")
@@ -148,4 +149,35 @@
(with-output-to-string
(λ () (display-schedule 1 #:schedule schdl)))))
+;;;
+;;; Running jobs
+;;;
+
+;;; Import private global.
+(define number-children (@@ (mcron base) number-children))
+
+;;; Import private procedures.
+(define update-number-children! (@@ (mcron base) update-number-children!))
+
+;;; Check 'number-children' initial value.
+(let ((schdl (make-schedule '() '() 'user)))
+ (test-equal "number-children: init"
+ 0
+ (unbox number-children)))
+
+;;; Check 'update-number-children!' incrementation.
+(let ((schdl (make-schedule '() '() 'user)))
+ (update-number-children! 1+)
+ (update-number-children! 1+)
+ (test-equal "update-number-children!: 1+"
+ 2
+ (unbox number-children)))
+
+;;; Check 'update-number-children!' decrementation.
+(let ((schdl (make-schedule '() '() 'user)))
+ (update-number-children! 1-)
+ (test-equal "update-number-children!: 1-"
+ 1
+ (unbox number-children)))
+
(test-end)