13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with Megatest. If not, see <http://www.gnu.org/licenses/>.
;;
;; strftime('%m/%d/%Y %H:%M:%S','now','localtime')
(require-extension test)
(require-extension regex)
(require-extension srfi-18)
(require-extension posix)
(import posix)
(import srfi-18)
;; (require-extension zmq)
;; (import zmq)
(define test-work-dir (current-directory))
;; given list of lists
;; ( ( msg expected param1 param2 ...)
;; ( ... ) )
;; apply test to all
;;
(define (test-batch proc pname inlst #!key (post-proc #f))
(for-each
(lambda (spec)
(let ((msg (conc pname " " (car spec)))
(result (cadr spec))
(params (cddr spec)))
(if post-proc
(test msg result (post-proc (apply proc params)))
(test msg result (apply proc params)))))
inlst))
;; read in all the _record files
(let ((files (glob "*_records.scm")))
(for-each
(lambda (file)
(print "Loading " file)
(load file))
files))
(let* ((unit-test-name (list-ref (argv) 4))
(fname (conc "../unittests/" unit-test-name ".scm")))
(if (file-exists? fname)
(load fname)
(print "ERROR: Unit test " unit-test-name " not found in unittests directory")))
;;; huh? why is this here?
;; (list "abc" "abc/%" "ab%/c%" "~abc/c%" "abc/~c%" "a,b/c,%/d" "%/,%/a" "%/,%/a" "%/,%/a" "%" "%" "%/" "%/" "%abc%")
;; (list "abc" "abc" "abcd" "abc" "abc" "a" "abc" "def" "ghi" "a" "a" "a" "a" "abc")
;; (list "" "" "cde" "cde" "cde" "" "" "a" "b" "" "b" "" "b" "abc")
;; (list #t #t #t #f #f #t #t #t #f #t #t #t #f #t)
|
<
<
<
<
<
<
<
|
|
|
|
|
|
<
<
<
<
<
<
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with Megatest. If not, see <http://www.gnu.org/licenses/>.
;;
;; strftime('%m/%d/%Y %H:%M:%S','now','localtime')
(import srfi-18)
(define test-work-dir (current-directory))
;; given list of lists
;; ( ( msg expected param1 param2 ...)
;; ( ... ) )
;; apply test to all
;;
(define (test-batch proc pname inlst #!key (post-proc #f))
(for-each
(lambda (spec)
(let ((msg (conc pname " " (car spec)))
(result (cadr spec))
(params (cddr spec)))
(if post-proc
(test msg result (post-proc (apply proc params)))
(test msg result (apply proc params)))))
inlst))
;; read in all the _record files
;; (let ((files (glob "*_records.scm")))
;; (for-each
;; (lambda (file)
;; (print "Loading " file)
;; (load file))
;; files))
(let* ((unit-test-name (list-ref (argv) 4))
(fname (conc "../unittests/" unit-test-name ".scm")))
(if (file-exists? fname)
(load fname)
(print "ERROR: Unit test " unit-test-name " not found in unittests directory")))
|