You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

(define-module (yacswa debugging)
#:use-module (tk short)
#:export (test-hr
test-pc
test-data
test-mode?
test-on
test-off))
(define test-hr (make-hook 1))
(define test-pc (make-hook 1))
(define test-data (make-hook 1))
;; hrinfo
(add-hook! test-hr
(lambda (sym)
(begin (display-if-not (symbol-property sym 'province)
"province key missing: " (ss< sym))
(display-if-not (symbol-property sym 'terse)
"terse key missing: " (ss< sym))
(display-if-not (symbol-property sym 'hr_full)
"hr_full key missing: " (ss< sym))
(display-if-not (symbol-property sym 'population)
"population data missing: " (ss< sym)))))
;; process-stats
(add-hook! test-data
(lambda (sym)
(let ((report-ls (if-some (symbol-property sym 'reports))))
(display-if-not (<= 14 (length report-ls))
"Not enough reports under " (ss< sym)
"(" (number->string (length report-ls)) ")"))))
;; pcinfo
(add-hook! test-pc
(lambda (sym)
(begin (display-if-not (symbol-fref sym)
"association missing: " (ss< sym)))))
(define test-mode? #f)
(define (test-on)
(set! test-mode? #t))
(define (test-off)
(set! test-mode? #f))