network-tests: Compare hash tables directly.
These comparisons wouldn't work before because I was using mutable hashes.
This commit is contained in:
parent
4a6888ddde
commit
04bc619b7d
1 changed files with 13 additions and 15 deletions
|
@ -20,16 +20,14 @@
|
|||
(test-case "One-step syncronous update"
|
||||
(let* ([s (make-state '((x1 . #t) (x2 . #f)))]
|
||||
[new-s (update bn s '(x2 x1))])
|
||||
(check-equal? (hash-ref new-s 'x1) #t)
|
||||
(check-equal? (hash-ref new-s 'x2) #t)
|
||||
(check-equal? (length (hash-keys new-s)) 2)))
|
||||
(check-equal? s #hash((x1 . #t) (x2 . #f)))
|
||||
(check-equal? new-s #hash((x1 . #t) (x2 . #t)))))
|
||||
|
||||
(test-case "One-step asynchronous update"
|
||||
(let* ([s (make-state '((x1 . #f) (x2 . #f)))]
|
||||
[new-s (update bn s '(x2 x1))])
|
||||
(check-equal? (hash-ref new-s 'x1) #f)
|
||||
(check-equal? (hash-ref new-s 'x2) #t)
|
||||
(check-equal? (length (hash-keys new-s)) 2)))))
|
||||
(check-equal? s #hash((x1 . #f) (x2 . #f)))
|
||||
(check-equal? new-s #hash((x1 . #f) (x2 . #t)))))))
|
||||
|
||||
(test-case "Syntactic description of Boolean networks"
|
||||
(let ([s (make-state '((x . #t) (y . #f)))]
|
||||
|
@ -60,15 +58,15 @@
|
|||
(check-false (has-edge? ig 'c 'b))
|
||||
(check-false (has-edge? ig 'c 'a)))
|
||||
|
||||
(check-equal? (map hash->list (build-all-states #hash((a . (#t #f)) (b . (1 2 3)))))
|
||||
'(((a . #t) (b . 1))
|
||||
((a . #t) (b . 2))
|
||||
((a . #t) (b . 3))
|
||||
((a . #f) (b . 1))
|
||||
((a . #f) (b . 2))
|
||||
((a . #f) (b . 3))))
|
||||
(check-equal? (hash->list (make-boolean-domains '(a b)))
|
||||
'((a . (#f #t)) (b . (#f #t))))
|
||||
(check-equal? (build-all-states #hash((a . (#t #f)) (b . (1 2 3))))
|
||||
'(#hash((a . #t) (b . 1))
|
||||
#hash((a . #t) (b . 2))
|
||||
#hash((a . #t) (b . 3))
|
||||
#hash((a . #f) (b . 1))
|
||||
#hash((a . #f) (b . 2))
|
||||
#hash((a . #f) (b . 3))))
|
||||
(check-equal? (make-boolean-domains '(a b))
|
||||
#hash((a . (#f #t)) (b . (#f #t))))
|
||||
|
||||
(let* ([n #hash((a . (not b)) (b . a))]
|
||||
[doms (make-boolean-domains '(a b))]
|
||||
|
|
Loading…
Reference in a new issue