networks: Make it possible to skip expensive test cases.
At the moment, this is particularly for skipping the tests constructing the interaction graphs.
This commit is contained in:
parent
097c5a7f09
commit
f1a1123cc4
1 changed files with 48 additions and 35 deletions
19
networks.rkt
19
networks.rkt
|
@ -150,7 +150,12 @@
|
||||||
[sbn? contract?]))
|
[sbn? contract?]))
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(require rackunit))
|
(require rackunit)
|
||||||
|
;; When this variable is set to #t, some particularly expensive test
|
||||||
|
;; cases are omitted.
|
||||||
|
(define skip-expensive-tests? #t)
|
||||||
|
(unless skip-expensive-tests?
|
||||||
|
(displayln "Running the complete test suite...")))
|
||||||
|
|
||||||
|
|
||||||
;;; =================
|
;;; =================
|
||||||
|
@ -526,6 +531,10 @@
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(test-case "build-interaction-graph"
|
(test-case "build-interaction-graph"
|
||||||
|
(cond
|
||||||
|
[skip-expensive-tests?
|
||||||
|
(displayln "Skipping test case build-interaction-graph.")]
|
||||||
|
[else
|
||||||
(define n-bool
|
(define n-bool
|
||||||
(hash 'x '(not y)
|
(hash 'x '(not y)
|
||||||
'y 'x
|
'y 'x
|
||||||
|
@ -542,7 +551,7 @@
|
||||||
't '(abs (- y 1))))
|
't '(abs (- y 1))))
|
||||||
(define 123-doms (make-same-domains '(x y z t) '(0 1 2)))
|
(define 123-doms (make-same-domains '(x y z t) '(0 1 2)))
|
||||||
(check-equal? (graphviz (build-interaction-graph/form n-multi 123-doms))
|
(check-equal? (graphviz (build-interaction-graph/form n-multi 123-doms))
|
||||||
"digraph G {\n\tnode0 [label=\"y\"];\n\tnode1 [label=\"z\"];\n\tnode2 [label=\"x\"];\n\tnode3 [label=\"t\"];\n\tsubgraph U {\n\t\tedge [dir=none];\n\t\tnode0 -> node0;\n\t}\n\tsubgraph D {\n\t\tnode0 -> node2;\n\t\tnode0 -> node3;\n\t\tnode0 -> node1;\n\t}\n}\n")))
|
"digraph G {\n\tnode0 [label=\"y\"];\n\tnode1 [label=\"z\"];\n\tnode2 [label=\"x\"];\n\tnode3 [label=\"t\"];\n\tsubgraph U {\n\t\tedge [dir=none];\n\t\tnode0 -> node0;\n\t}\n\tsubgraph D {\n\t\tnode0 -> node2;\n\t\tnode0 -> node3;\n\t\tnode0 -> node1;\n\t}\n}\n")])))
|
||||||
|
|
||||||
;;; Given a network, builds its signed interaction graph. The graph
|
;;; Given a network, builds its signed interaction graph. The graph
|
||||||
;;; has variables as nodes and has a directed edge from x to
|
;;; has variables as nodes and has a directed edge from x to
|
||||||
|
@ -564,6 +573,10 @@
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(test-case "build-signed-interaction-graph"
|
(test-case "build-signed-interaction-graph"
|
||||||
|
(cond
|
||||||
|
[skip-expensive-tests?
|
||||||
|
(displayln "Skipping test case build-signed-interaction-graph.")]
|
||||||
|
[else
|
||||||
(define n-bool
|
(define n-bool
|
||||||
(hash 'x '(not y)
|
(hash 'x '(not y)
|
||||||
'y 'x
|
'y 'x
|
||||||
|
@ -580,7 +593,7 @@
|
||||||
't '(abs (- y 1))))
|
't '(abs (- y 1))))
|
||||||
(define 123-doms (make-same-domains '(x y z t) '(0 1 2)))
|
(define 123-doms (make-same-domains '(x y z t) '(0 1 2)))
|
||||||
(check-equal? (graphviz (build-signed-interaction-graph/form n-multi 123-doms))
|
(check-equal? (graphviz (build-signed-interaction-graph/form n-multi 123-doms))
|
||||||
"digraph G {\n\tnode0 [label=\"y\"];\n\tnode1 [label=\"z\"];\n\tnode2 [label=\"x\"];\n\tnode3 [label=\"t\"];\n\tsubgraph U {\n\t\tedge [dir=none];\n\t\tnode0 -> node0 [label=\"1\"];\n\t}\n\tsubgraph D {\n\t\tnode0 -> node2 [label=\"1\"];\n\t\tnode0 -> node3 [label=\"0\"];\n\t\tnode0 -> node1 [label=\"-1\"];\n\t}\n}\n")))
|
"digraph G {\n\tnode0 [label=\"y\"];\n\tnode1 [label=\"z\"];\n\tnode2 [label=\"x\"];\n\tnode3 [label=\"t\"];\n\tsubgraph U {\n\t\tedge [dir=none];\n\t\tnode0 -> node0 [label=\"1\"];\n\t}\n\tsubgraph D {\n\t\tnode0 -> node2 [label=\"1\"];\n\t\tnode0 -> node3 [label=\"0\"];\n\t\tnode0 -> node1 [label=\"-1\"];\n\t}\n}\n")])))
|
||||||
|
|
||||||
;;; ====================
|
;;; ====================
|
||||||
;;; Dynamics of networks
|
;;; Dynamics of networks
|
||||||
|
|
Loading…
Reference in a new issue