Attachment "graph_2811747.patch" to
ticket [2811747fff]
added by
andreas_kupries
2009-11-03 05:38:07.
Index: graph1.test
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/graph1.test,v
retrieving revision 1.9
diff -w -u -r1.9 graph1.test
--- graph1.test 20 Nov 2008 07:26:43 -0000 1.9
+++ graph1.test 2 Nov 2009 22:37:02 -0000
@@ -23,47 +23,43 @@
useLocal graph1.tcl struct::graph
}
-# -------------------------------------------------------------------------
-
-namespace import ::struct::graph::graph
-
# ---------------------------------------------------
test graph1-0.1 {graph errors} {
- graph mygraph
- catch {graph mygraph} msg
+ struct::graph mygraph
+ catch {struct::graph mygraph} msg
mygraph destroy
set msg
} "command \"mygraph\" already exists, unable to create graph"
test graph1-0.2 {graph errors} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph option ?arg arg ...?\""
test graph1-0.3 {graph errors} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph foo} msg
mygraph destroy
set msg
} "bad option \"foo\": must be arc, arcs, destroy, get, getall, keys, keyexists, node, nodes, set, swap, unset, or walk"
test graph1-0.4 {graph errors} {
- catch {graph set} msg
+ catch {struct::graph set} msg
set msg
} "command \"set\" already exists, unable to create graph"
test graph1-0.5 {graph errors} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc foo} msg
mygraph destroy
set msg
} "bad option \"foo\": must be append, delete, exists, get, getall, insert, keys, keyexists, lappend, set, source, target, or unset"
test graph1-0.6 {graph errors} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node foo} msg
mygraph destroy
set msg
@@ -72,21 +68,21 @@
# ---------------------------------------------------
test graph1-1.1 {create} {
- graph mygraph
+ struct::graph mygraph
set result [string equal [info commands ::mygraph] "::mygraph"]
mygraph destroy
set result
} 1
test graph1-1.2 {create} {
- set name [graph]
+ set name [struct::graph]
set result [list $name [string equal [info commands ::$name] "::$name"]]
$name destroy
set result
} [list graph1 1]
test graph1-1.3 {destroy} {
- graph mygraph
+ struct::graph mygraph
mygraph destroy
string equal [info commands ::mygraph] ""
} 1
@@ -94,14 +90,14 @@
# ---------------------------------------------------
test graph1-2.1 {arc delete} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc delete arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-2.2 {arc delete} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
@@ -116,7 +112,7 @@
# ---------------------------------------------------
test graph1-3.1 {arc exists} {
- graph mygraph
+ struct::graph mygraph
set result [list]
lappend result [mygraph arc exists arc1]
mygraph node insert node1
@@ -132,14 +128,14 @@
# ---------------------------------------------------
test graph1-4.1 {arc get gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc get arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-4.2 {arc get gives error on bogus key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -149,7 +145,7 @@
} "invalid key \"bogus\" for arc \"arc0\""
test graph1-4.3 {arc get uses data as default key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -160,7 +156,7 @@
} "foobar"
test graph1-4.4 {arc get respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -173,7 +169,7 @@
# ---------------------------------------------------
test graph1-5.1 {arc insert gives error on duplicate arc name} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -183,7 +179,7 @@
} "arc \"arc0\" already exists in graph \"mygraph\""
test graph1-5.2 {arc insert creates and initializes arc} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -197,7 +193,7 @@
} {1 node0 node1 {}}
test graph1-5.3 {arc insert arcs in correct location} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
@@ -210,14 +206,14 @@
} {arc0 arc1 arc2}
test graph1-5.4 {arc insert gives error when trying to insert to a fake node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc insert node0 node1 arc0} msg
mygraph destroy
set msg
} "source node \"node0\" does not exist in graph \"mygraph\""
test graph1-5.5 {arc insert gives error when trying to insert to a fake node} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph arc insert node0 node1 arc0} msg
mygraph destroy
@@ -225,7 +221,7 @@
} "target node \"node1\" does not exist in graph \"mygraph\""
test graph1-5.6 {arc insert generates arc name when none is given} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert n0
set result [list [mygraph arc insert n0 n0]]
@@ -239,7 +235,7 @@
if {0} {
# if feature used, fix this test...
test graph1-5.6 {arc insert generates arc name when none is given} {
- graph mygraph
+ struct::graph mygraph
set result [list [mygraph insert root end]]
lappend result [mygraph insert root end]
mygraph insert root end arc3
@@ -252,14 +248,14 @@
# ---------------------------------------------------
test graph1-6.1 {arc set gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc set arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-6.2 {arc set with arc name gets/sets "data" value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -270,7 +266,7 @@
} "foobar"
test graph1-6.3 {arc set with arc name and key gets/sets key value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -281,7 +277,7 @@
} [list "" "foobar"]
test graph1-6.4 {arc set with too many args gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -291,7 +287,7 @@
} "wrong # args: should be \"mygraph arc set arc0 ?-key key? ?value?\""
test graph1-6.5 {arc set with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -301,7 +297,7 @@
} "invalid option \"foo\": should be key"
test graph1-6.6 {arc set with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -311,7 +307,7 @@
} "invalid option \"foo\": should be key"
test graph1-6.7 {arc set with bad key gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -323,14 +319,14 @@
# ---------------------------------------------------
test graph1-7.1 {arc source gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc source arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-7.2 {arc source} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -342,14 +338,14 @@
# ---------------------------------------------------
test graph1-8.1 {arc target gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc target arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-8.2 {arc target} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -361,14 +357,14 @@
# ---------------------------------------------------
test graph1-9.1 {arc unset gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc unset arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-9.2 {arc unset does not give error on bogus key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -378,7 +374,7 @@
} 0
test graph1-9.3 {arc unset removes a keyed value from a arc} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -390,7 +386,7 @@
} "invalid key \"foobar\" for arc \"arc0\""
test graph1-9.4 {arc unset requires -key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -403,35 +399,35 @@
# ---------------------------------------------------
test graph1-10.1 {arcs} {
- graph mygraph
+ struct::graph mygraph
set result [mygraph arcs]
mygraph destroy
set result
} {}
test graph1-10.2 {arcs} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arcs -foo} msg
mygraph destroy
set msg
} {invalid restriction "-foo": should be -in, -out, -adj, -inner, -embedding, -key or -value}
test graph1-10.3 {arcs} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arcs -in} msg
mygraph destroy
set msg
} {no nodes specified: should be "mygraph arcs ?-key key? ?-value value? ?-in|-out|-adj|-inner|-embedding node node...?"}
test graph1-10.4 {arcs} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arcs -in node0} msg
mygraph destroy
set msg
} {node "node0" does not exist in graph "mygraph"}
test graph1-10.5 {arcs} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1
mygraph node insert node2
mygraph node insert node3
@@ -480,7 +476,7 @@
]
test graph1-10.6 {arcs} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1
mygraph node insert node2
mygraph arc insert node1 node2 arcE
@@ -491,7 +487,7 @@
} {arcE arcF}
test graph1-10.7 {arcs} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert n0
mygraph node insert n1
mygraph arc insert n0 n1 a1
@@ -504,7 +500,7 @@
} {a1}
test graph1-10.8 {arcs} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert n0
mygraph node insert n1
mygraph arc insert n0 n1 a1
@@ -517,28 +513,28 @@
} {a1}
test graph1-10.9 {arcs, multiple -key, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arcs -key foobar -value 1 -key foo} msg
mygraph destroy
set msg
} {invalid restriction: illegal multiple use of "-key"}
test graph1-10.10 {arcs, multiple -value, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arcs -key foobar -value 1 -value foo} msg
mygraph destroy
set msg
} {invalid restriction: illegal multiple use of "-value"}
test graph1-10.11 {arcs, multiple -in, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arcs -key foobar -in -value foo -in} msg
mygraph destroy
set msg
} {invalid restriction: illegal multiple use of "-in"|"-out"|"-adj"|"-inner"|"-embedding"}
test graph1-10.12 {arcs, -in / -out exclusion, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arcs -key foobar -out -value foo -in} msg
mygraph destroy
set msg
@@ -547,35 +543,35 @@
# ---------------------------------------------------
test graph1-11.1 {node degree} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node degree} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph node degree ?-in|-out? node\""
test graph1-11.2 {node degree} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node degree foo bar baz} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph node degree ?-in|-out? node\""
test graph1-11.3 {node degree} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node degree node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-11.4 {node degree} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node degree -foo node0} msg
mygraph destroy
set msg
} "invalid option \"-foo\": should be -in or -out"
test graph1-11.5 {node degree} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph node insert node2
@@ -624,14 +620,14 @@
# ---------------------------------------------------
test graph1-12.1 {node delete} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node delete node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-12.2 {node delete} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node delete node0
set result [mygraph node exists node0]
@@ -640,7 +636,7 @@
} {0}
test graph1-12.3 {node delete} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -656,7 +652,7 @@
} {0 1 0}
test graph1-12.4 {node delete} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -674,7 +670,7 @@
# ---------------------------------------------------
test graph1-13.1 {node exists} {
- graph mygraph
+ struct::graph mygraph
set result [list]
lappend result [mygraph node exists node1]
mygraph node insert node1
@@ -688,14 +684,14 @@
# ---------------------------------------------------
test graph1-14.1 {node get gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node get node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-14.2 {node get gives error on bogus key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node get node0 -key bogus} msg
mygraph destroy
@@ -703,7 +699,7 @@
} "invalid key \"bogus\" for node \"node0\""
test graph1-14.3 {node get uses data as default key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 foobar
set result [mygraph node get node0]
@@ -712,7 +708,7 @@
} "foobar"
test graph1-14.4 {node get respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key boom foobar
set result [mygraph node get node0 -key boom]
@@ -723,7 +719,7 @@
# ---------------------------------------------------
test graph1-15.1 {node insert gives error on duplicate node name} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node insert node0} msg
mygraph destroy
@@ -731,7 +727,7 @@
} "node \"node0\" already exists in graph \"mygraph\""
test graph1-15.2 {node insert creates and initializes node} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
set result [list ]
lappend result [mygraph node exists node0]
@@ -741,7 +737,7 @@
} {1 {}}
test graph1-15.3 {node insert generates node name when none is given} {
- graph mygraph
+ struct::graph mygraph
set result [list [mygraph node insert]]
lappend result [mygraph node insert]
@@ -754,7 +750,7 @@
if {0} {
# fix if this feature is used ...
test graph1-15.x {node insert generates node name when none is given} {
- graph mygraph
+ struct::graph mygraph
set result [list [mygraph node insert root end]]
lappend result [mygraph node insert root end]
mygraph node insert root end node3
@@ -767,14 +763,14 @@
# ---------------------------------------------------
test graph1-16.1 {node opposite gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node opposite node0 arc0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-16.2 {node opposite gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node opposite node0 arc0} msg
mygraph destroy
@@ -782,7 +778,7 @@
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-16.3 {node opposite gives error on bogus node/arc combination} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph node insert node2
@@ -794,7 +790,7 @@
} "node \"node0\" and arc \"arc0\" are not connected in graph \"mygraph\""
test graph1-16.4 {node opposite} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -808,7 +804,7 @@
} {node1 node0}
test graph1-16.5 {node opposite} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph arc insert node0 node0 arc0
set result [mygraph node opposite node0 arc0]
@@ -819,14 +815,14 @@
# ---------------------------------------------------
test graph1-17.1 {node set gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node set node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-17.2 {node set with node name gets/sets "data" value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 foobar
set result [mygraph node set node0]
@@ -835,7 +831,7 @@
} "foobar"
test graph1-17.3 {node set with node name and key gets/sets key value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key baz foobar
set result [list [mygraph node set node0] [mygraph node set node0 -key baz]]
@@ -844,7 +840,7 @@
} [list "" "foobar"]
test graph1-17.4 {node set with too many args gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node set node0 foo bar baz boo} msg
mygraph destroy
@@ -852,7 +848,7 @@
} "wrong # args: should be \"mygraph node set node0 ?-key key? ?value?\""
test graph1-17.5 {node set with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node set node0 foo bar} msg
mygraph destroy
@@ -860,7 +856,7 @@
} "invalid option \"foo\": should be key"
test graph1-17.6 {node set with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node set node0 foo bar baz} msg
mygraph destroy
@@ -868,7 +864,7 @@
} "invalid option \"foo\": should be key"
test graph1-17.7 {node set with bad key gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node set node0 -key foo} msg
mygraph destroy
@@ -878,14 +874,14 @@
# ---------------------------------------------------
test graph1-18.1 {node unset gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node unset node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-18.2 {node unset does not give error on bogus key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
set result [catch {mygraph node unset node0 -key bogus}]
mygraph destroy
@@ -893,7 +889,7 @@
} 0
test graph1-18.3 {node unset removes a keyed value from a node} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key foobar foobar
mygraph node unset node0 -key foobar
@@ -903,7 +899,7 @@
} "invalid key \"foobar\" for node \"node0\""
test graph1-18.4 {unset requires -key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key foobar foobar
catch {mygraph node unset node0 flaboozle foobar} msg
@@ -914,35 +910,35 @@
# ---------------------------------------------------
test graph1-19.1 {nodes} {
- graph mygraph
+ struct::graph mygraph
set result [mygraph nodes]
mygraph destroy
set result
} {}
test graph1-19.2 {nodes} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph nodes -foo} msg
mygraph destroy
set msg
} {invalid restriction "-foo": should be -in, -out, -adj, -inner, -embedding, -key or -value}
test graph1-19.3 {nodes} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph nodes -in} msg
mygraph destroy
set msg
} {no nodes specified: should be "mygraph nodes ?-key key? ?-value value? ?-in|-out|-adj|-inner|-embedding node node...?"}
test graph1-19.4 {nodes} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph nodes -in node0} msg
mygraph destroy
set msg
} {node "node0" does not exist in graph "mygraph"}
test graph1-19.5 {nodes} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1
mygraph node insert node2
mygraph node insert node3
@@ -991,7 +987,7 @@
]
test graph1-19.6 {nodes} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1
mygraph node insert node2
mygraph node insert node3
@@ -1008,7 +1004,7 @@
test graph1-19.7 {nodes} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert n0
mygraph node insert n1
mygraph node set n0 -key foobar 1
@@ -1019,7 +1015,7 @@
} {n0}
test graph1-19.8 {nodes} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert n0
mygraph node insert n1
mygraph node set n0 -key foobar 1
@@ -1030,28 +1026,28 @@
} {n0}
test graph1-19.9 {nodes, multiple -keys, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph nodes -key foobar -key 1} msg
mygraph destroy
set msg
} {invalid restriction: illegal multiple use of "-key"}
test graph1-19.10 {nodes, multiple -value, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph nodes -key foobar -value 1 -value foo} msg
mygraph destroy
set msg
} {invalid restriction: illegal multiple use of "-value"}
test graph1-19.11 {nodes, multiple -in, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph nodes -key foobar -in -value foo -in} msg
mygraph destroy
set msg
} {invalid restriction: illegal multiple use of "-in"|"-out"|"-adj"|"-inner"|"-embedding"}
test graph1-19.12 {nodes, -in / -out exclusion, illegal} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph nodes -key foobar -out -value foo -in} msg
mygraph destroy
set msg
@@ -1060,14 +1056,14 @@
# ---------------------------------------------------
test graph1-20.1 {swap gives error when trying to swap non existant node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph swap node0 node1} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-20.2 {swap gives error when trying to swap non existant node} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph swap node0 node1} msg
mygraph destroy
@@ -1075,7 +1071,7 @@
} "node \"node1\" does not exist in graph \"mygraph\""
test graph1-20.3 {swap gives error when trying to swap node with self} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph swap node0 node0} msg
mygraph destroy
@@ -1083,7 +1079,7 @@
} "cannot swap node \"node0\" with itself"
test graph1-20.4 {swap swaps node relationships correctly} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node0.1
mygraph node insert node0.2
@@ -1106,7 +1102,7 @@
} {{node0.1.1 node0.1.2} {node0 node0.2}}
test graph1-20.5 {swap swaps node relationships correctly} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node0.1
mygraph node insert node0.2
@@ -1129,7 +1125,7 @@
} {{} {node0.1 node0.2}}
test graph1-20.6 {swap swaps node relationships correctly} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node0.1
mygraph node insert node0.2
@@ -1152,13 +1148,13 @@
} {{node0.1.1 node0.1.2} {node0 node0.2}}
test graph1-22.1 {arc getall gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc getall arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-22.2 {arc getall gives error when key specified} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1167,7 +1163,7 @@
set msg
} "wrong # args: should be none"
test graph1-22.3 {arc getall with node name returns list of key/value pairs} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1179,20 +1175,20 @@
} "data foobar other thing"
test graph1-23.1 {node getall gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node getall node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-23.2 {node getall gives error when key specified} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node getall node0 -key data} msg
mygraph destroy
set msg
} "wrong # args: should be none"
test graph1-23.3 {node getall with node name returns list of key/value pairs} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 foobar
mygraph node set node0 -key other thing
@@ -1202,13 +1198,13 @@
} "data foobar other thing"
test graph1-24.1 {arc keys gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc keys arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-24.2 {arc keys gives error when key specified} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1217,7 +1213,7 @@
set msg
} "wrong # args: should be none"
test graph1-24.3 {arc keys with arc name returns list of keys} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1228,20 +1224,20 @@
} "data other"
test graph1-25.1 {node keys gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node keys node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-25.2 {node keys gives error when key specified} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch { mygraph node keys node0 -key bogus } msg
mygraph destroy
set msg
} "wrong # args: should be none"
test graph1-25.3 {node keys with node name returns list of keys} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key other things
set results [mygraph node keys node0]
@@ -1250,13 +1246,13 @@
} "data other"
test graph1-26.1 {arc keyexists gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc keyexists arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-26.2 {arc keyexists returns false on non-existant key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1265,7 +1261,7 @@
set result
} "0"
test graph1-26.3 {arc keyexists uses data as default key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1274,7 +1270,7 @@
set result
} "1"
test graph1-26.4 {arc keyexists respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1285,27 +1281,27 @@
} "1"
test graph1-27.1 {node keyexists gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node keyexists node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-27.2 {node keyexists returns false on non-existant key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
set result [mygraph node keyexists node0 -key bogus]
mygraph destroy
set result
} "0"
test graph1-27.3 {node keyexists uses data as default key} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
set result [mygraph node keyexists node0]
mygraph destroy
set result
} "1"
test graph1-27.4 {node keyexists respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key boom foobar
set result [mygraph node keyexists node0 -key boom]
@@ -1314,13 +1310,13 @@
} "1"
test graph1-28.1 {arc append gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc append arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-28.2 {arc append with arc name appends to "data" value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1330,7 +1326,7 @@
set result
} "foobar"
test graph1-28.3 {arc append with arc name and key appends key value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1340,7 +1336,7 @@
set result
} "foobar"
test graph1-28.4 {arc append with too many args gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1349,7 +1345,7 @@
set msg
} "wrong # args: should be \"mygraph arc append arc0 ?-key key? value\""
test graph1-28.5 {arc append with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1358,7 +1354,7 @@
set msg
} "invalid option \"-foo\": should be -key"
test graph1-28.6 {arc append respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1369,13 +1365,13 @@
} "foobar"
test graph1-29.1 {arc lappend gives error on bogus arc} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph arc lappend arc0} msg
mygraph destroy
set msg
} "arc \"arc0\" does not exist in graph \"mygraph\""
test graph1-29.2 {arc lappend with node arc lappends to "data" value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1385,7 +1381,7 @@
set result
} "foo bar"
test graph1-29.3 {arc lappend with arc name and key lappends key value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1395,7 +1391,7 @@
set result
} "foo bar"
test graph1-29.4 {arc lappend with too many args gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1404,7 +1400,7 @@
set msg
} "wrong # args: should be \"mygraph arc lappend arc0 ?-key key? value\""
test graph1-29.5 {arc lappend with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1413,7 +1409,7 @@
set msg
} "invalid option \"-foo\": should be -key"
test graph1-29.6 {arc lappend respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node insert node1
mygraph arc insert node0 node1 arc0
@@ -1424,13 +1420,13 @@
} "foo bar"
test graph1-30.1 {node append gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node append node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-30.2 {node append with node name appends to "data" value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 foo
set result [mygraph node append node0 bar]
@@ -1438,7 +1434,7 @@
set result
} "foobar"
test graph1-30.3 {node append with node name and key appends key value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key baz foo
set result [mygraph node append node0 -key baz bar]
@@ -1446,21 +1442,21 @@
set result
} "foobar"
test graph1-30.4 {node append with too many args gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node append node0 foo bar baz boo} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph node append node0 ?-key key? value\""
test graph1-30.5 {node append with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node append node0 -foo bar baz} msg
mygraph destroy
set msg
} "invalid option \"-foo\": should be -key"
test graph1-30.6 {node append respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key baz foo
set result [mygraph node append node0 -key baz bar]
@@ -1469,13 +1465,13 @@
} "foobar"
test graph1-31.1 {node lappend gives error on bogus node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph node lappend node0} msg
mygraph destroy
set msg
} "node \"node0\" does not exist in graph \"mygraph\""
test graph1-32.2 {node lappend with node name lappends to "data" value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 foo
set result [mygraph node lappend node0 bar]
@@ -1483,7 +1479,7 @@
set result
} "foo bar"
test graph1-32.3 {node lappend with node name and key lappends key value} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key baz foo
set result [mygraph node lappend node0 -key baz bar]
@@ -1491,21 +1487,21 @@
set result
} "foo bar"
test graph1-32.4 {node lappend with too many args gives error} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node lappend node0 foo bar baz boo} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph node lappend node0 ?-key key? value\""
test graph1-32.5 {node lappend with bad args} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
catch {mygraph node lappend node0 -foo bar baz} msg
mygraph destroy
set msg
} "invalid option \"-foo\": should be -key"
test graph1-32.6 {node lappend respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert node0
mygraph node set node0 -key baz foo
set result [mygraph node lappend node0 -key baz bar]
@@ -1517,7 +1513,7 @@
# ---------------------------------------------------
proc makegraph {} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert i
mygraph node insert ii
@@ -1547,28 +1543,28 @@
test graph1-21.1 {walk with too few args} {badTest} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph walk} msg
mygraph destroy
set msg
} "no value given for parameter \"node\" to \"::struct::graph::_walk\""
test graph1-21.2 {walk with too few args} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph walk node0} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph walk node0 ?-dir forward|backward? ?-order pre|post|both? ?-type {bfs|dfs}? -command cmd\""
test graph1-21.3 {walk with too many args} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph walk node0 -foo bar -baz boo -foo2 boo -foo3 baz -foo4 baz} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph walk node0 ?-dir forward|backward? ?-order pre|post|both? ?-type {bfs|dfs}? -command cmd\""
test graph1-21.4 {walk with fake node} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph walk node0 -command {}} msg
mygraph destroy
set msg
@@ -1751,14 +1747,14 @@
# ---------------------------------------------------
test graph1-33.1 {get gives error on bogus key} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph get -key bogus} msg
mygraph destroy
set msg
} "invalid key \"bogus\" for graph \"mygraph\""
test graph1-33.2 {get uses data as default key} {
- graph mygraph
+ struct::graph mygraph
mygraph set foobar
set result [mygraph get]
mygraph destroy
@@ -1766,7 +1762,7 @@
} "foobar"
test graph1-33.3 {get respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph set -key boom foobar
set result [mygraph get -key boom]
mygraph destroy
@@ -1776,7 +1772,7 @@
# ---------------------------------------------------
test graph1-34.1 {set alone gets/sets "data" value} {
- graph mygraph
+ struct::graph mygraph
mygraph set foobar
set result [mygraph set]
mygraph destroy
@@ -1784,7 +1780,7 @@
} "foobar"
test graph1-34.2 {set with key gets/sets key value} {
- graph mygraph
+ struct::graph mygraph
mygraph set -key baz foobar
set result [list [mygraph set] [mygraph set -key baz]]
mygraph destroy
@@ -1792,28 +1788,28 @@
} [list "" "foobar"]
test graph1-34.3 {set with too many args gives error} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph set foo bar baz boo} msg
mygraph destroy
set msg
} "wrong # args: should be \"mygraph set ?-key key? ?value?\""
test graph1-34.4 {set with bad args} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph set foo bar} msg
mygraph destroy
set msg
} "invalid option \"foo\": should be key"
test graph1-34.5 {set with bad args} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph set foo bar baz} msg
mygraph destroy
set msg
} "invalid option \"foo\": should be key"
test graph1-34.6 {set with bad key gives error} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph set -key foo} msg
mygraph destroy
set msg
@@ -1822,14 +1818,14 @@
# ---------------------------------------------------
test graph1-35.1 {unset does not give error on bogus key} {
- graph mygraph
+ struct::graph mygraph
set result [catch {mygraph unset -key bogus}]
mygraph destroy
set result
} 0
test graph1-35.2 {unset removes a keyed value} {
- graph mygraph
+ struct::graph mygraph
mygraph set -key foobar foobar
mygraph unset -key foobar
catch {mygraph get -key foobar} msg
@@ -1838,7 +1834,7 @@
} "invalid key \"foobar\" for graph \"mygraph\""
test graph1-35.3 {unset requires -key} {
- graph mygraph
+ struct::graph mygraph
mygraph set -key foobar foobar
catch {mygraph unset flaboozle foobar} msg
mygraph destroy
@@ -1848,13 +1844,13 @@
# ---------------------------------------------------
test graph1-36.1 {getall gives error when key specified} {
- graph mygraph
+ struct::graph mygraph
catch {mygraph getall -key data} msg
mygraph destroy
set msg
} "wrong # args: should be none"
test graph1-36.2 {getall returns list of key/value pairs} {
- graph mygraph
+ struct::graph mygraph
mygraph set foobar
mygraph set -key other thing
set results [mygraph getall]
@@ -1863,13 +1859,13 @@
} "data foobar other thing"
test graph1-37.1 {keys gives error when key specified} {
- graph mygraph
+ struct::graph mygraph
catch { mygraph keys -key bogus } msg
mygraph destroy
set msg
} "wrong # args: should be none"
test graph1-37.2 {keys returns list of keys} {
- graph mygraph
+ struct::graph mygraph
mygraph set -key other things
set results [mygraph keys]
mygraph destroy
@@ -1877,19 +1873,19 @@
} "data other"
test graph1-38.1 {keyexists returns false on non-existant key} {
- graph mygraph
+ struct::graph mygraph
set result [mygraph keyexists -key bogus]
mygraph destroy
set result
} "0"
test graph1-38.2 {keyexists uses data as default key} {
- graph mygraph
+ struct::graph mygraph
set result [mygraph keyexists]
mygraph destroy
set result
} "1"
test graph1-38.3 {keyexists respects -key flag} {
- graph mygraph
+ struct::graph mygraph
mygraph set -key boom foobar
set result [mygraph keyexists -key boom]
mygraph destroy
@@ -1898,9 +1894,10 @@
# ---------------------------------------------------
# Big cleanup, get out of the way of graph v2.
-# Order of test files is graph, graph1, graphops, and the first and
-# last use graph v2. Leaving the class command of graph v1 in place
-# will mess up the handling of accelerated operations.
+#
+# Currently the order of test files is graph, graph1, graphops, and
+# the first and last use graph v2. Leaving the class command of graph
+# v1 in place will mess up the handling of accelerated operations.
rename struct::graph {}
Index: graph/tests/XOpsSetup
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/graph/tests/XOpsSetup,v
retrieving revision 1.12
diff -w -u -r1.12 XOpsSetup
--- graph/tests/XOpsSetup 24 Sep 2009 19:30:11 -0000 1.12
+++ graph/tests/XOpsSetup 2 Nov 2009 22:37:02 -0000
@@ -14,7 +14,7 @@
proc SETUP_A {} {
# Used by kruskal, prim tests
- graph mygraph
+ struct::graph mygraph
mygraph node insert 'node0'
mygraph node insert 'node1'
mygraph node insert 'node2'
@@ -86,7 +86,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
# Graph's nodes definition
mygraph node insert S
mygraph node insert A
@@ -119,7 +119,7 @@
}
proc SETUP_B2 {} {
- graph mygraph
+ struct::graph mygraph
mygraph node insert A B C D E F G
@@ -147,7 +147,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert A
mygraph node insert B
mygraph node insert C
@@ -179,7 +179,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert a
mygraph node insert b
mygraph node insert c
@@ -215,7 +215,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert 1w
mygraph node insert 1b
mygraph node insert 2w
@@ -269,7 +269,7 @@
# - maxMatching
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert 1w
mygraph node insert 1b
@@ -305,7 +305,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert 1w
mygraph node insert 1b
@@ -341,7 +341,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert A
mygraph node insert B
mygraph node insert C
@@ -367,7 +367,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert N1
mygraph node insert N2
@@ -390,7 +390,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert 1
mygraph node insert 2
@@ -415,7 +415,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert No1
mygraph node insert No2
@@ -444,7 +444,7 @@
proc SETUP_L {} {
# Koenigsberg.
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d
mygraph arc insert a c
mygraph arc insert a d
@@ -461,7 +461,7 @@
proc SETUP_M {} {
# penta-hex-something
- graph mygraph
+ struct::graph mygraph
mygraph node insert 1 2 3 4 5 6
mygraph arc insert 1 2
mygraph arc insert 2 3
@@ -485,7 +485,7 @@
# Author: Alejandro Eduardo Cruz Paz
# 28 August 2008
- graph mygraph
+ struct::graph mygraph
mygraph node insert 0 1 2 a b c d e f
mygraph arc insert 0 1
@@ -515,7 +515,7 @@
#Floyd-Warshall's
#Basic test
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node2 edge12
@@ -538,7 +538,7 @@
#Shortest Pathfinding by BFS algorithm
#BFS Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
@@ -579,7 +579,7 @@
#Johnson's Algorithm
#Floyd-Warshall's Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3
mygraph arc insert node1 node2 edge12
@@ -601,7 +601,7 @@
#Johnson's Algorithm
#Floyd-Warshall's Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node6
@@ -627,7 +627,7 @@
#Johnson's Algorithm
#Floyd-Warshall's Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5
mygraph arc insert node1 node2 edge12
@@ -661,7 +661,7 @@
#For distance searches: Johnson's and Bellman-Ford's
#Vertices Cover
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
@@ -704,7 +704,7 @@
#Johnson's Algorithm (Causes appearing of Inf values as a result)
#Metric Travelling Salesman 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5
@@ -727,7 +727,7 @@
#Floyd-Warshall's Algorithm
#
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5
@@ -765,7 +765,7 @@
#Johnson's Algorithm
#Floyd-Warshall's Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
@@ -804,7 +804,7 @@
#Weighted k-center 3-approximation algorithm
#Greedy Weighted Maximum Independent Set algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
@@ -832,7 +832,7 @@
#Metric Travelling Salesman 2-approximation algorithm
#Vertices Cover
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
@@ -873,7 +873,7 @@
#Christofides Algorithm
#Max Cut 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
@@ -934,7 +934,7 @@
proc SETUP_ADJACENCYLIST_K4 {} {
#special undirected K4 case where we have two arcs between two nodes
#with different sources and targets
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
@@ -974,7 +974,7 @@
proc SETUP_ADJACENCYLIST_1 {} {
#undirected and unweighted graph for Adjacency List Testing
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node2
@@ -995,7 +995,7 @@
#Used by:
#Metric Travelling Salesman 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node2
@@ -1027,7 +1027,7 @@
#Used by:
#Metric Travelling Salesman 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5
mygraph arc insert node1 node2
@@ -1054,7 +1054,7 @@
#Used by:
#Metric Travelling Salesman 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node2
@@ -1086,7 +1086,7 @@
#Used by:
#Max Cut 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node2 edge12
@@ -1105,7 +1105,7 @@
#Used by:
#Max Cut 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node3 edge13
@@ -1123,7 +1123,7 @@
#Used by:
#Max Cut 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node3
@@ -1144,7 +1144,7 @@
#Used by:
#Max Cut 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node2 edge12
@@ -1167,7 +1167,7 @@
#Used by:
#Max Cut 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node2
@@ -1191,7 +1191,7 @@
#Max Cut 2-approximation algorithm (subprocedure)
upvar 1 U varU V varV
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node3
@@ -1212,7 +1212,7 @@
#Max Cut 2-approximation algorithm (subprocedure)
upvar 1 U varU V varV
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node3
@@ -1235,7 +1235,7 @@
#Max Cut 2-approximation algorithm (subprocedure)
upvar 1 U varU V varV
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node1
@@ -1306,7 +1306,7 @@
#Metric Travelling Salesman 2-approximation algorithm
upvar 1 E edges
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node2 edge12
@@ -1347,7 +1347,7 @@
#Metric Travelling Salesman 2-approximation algorithm
upvar 1 E edges
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4
mygraph arc insert node1 node2 edge12
@@ -1371,7 +1371,7 @@
#Used by:
#Christofides Algorithm (Tight Example)
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6 node7
mygraph arc insert node1 node2 edge12
@@ -1399,7 +1399,7 @@
#Used by:
#Vertices Cover
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node2 edge12
@@ -1454,7 +1454,7 @@
#Used by:
#Vertices Cover
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node2 edge12
@@ -1478,7 +1478,7 @@
#Greedy Weighted Maximum Independent Set algorithm
#Vertices Cover
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5
mygraph arc insert node1 node2
@@ -1500,7 +1500,7 @@
#Greedy Maximum Independent Set algorithm
#Greedy Weighted Maximum Independent Set algorithm
- graph mygraph
+ struct::graph mygraph
#adding 24 nodes: node1 - node24
for {set i 1} {$i<=24} {incr i} {
@@ -1557,7 +1557,7 @@
#Unweighted k-center 2-approximation algorithm
#Weighted k-center 3-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6 node7
mygraph arc insert node1 node7 [list node1 node7]
mygraph arc insert node2 node7 [list node2 node7]
@@ -1596,7 +1596,7 @@
#Used by:
#Unweighted k-center 2-approximation algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6 node7 node8
@@ -1634,7 +1634,7 @@
#createSquaredGraph procedure
#Unweighted k-center 2-approximation algorithm (subprocedure that extends two-squared graphs)
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6 node7 node8
mygraph arc insert node1 node2 "node1 node2"
@@ -1657,7 +1657,7 @@
#createSquaredGraph procedure
#Unweighted k-center 2-approximation algorithm (subprocedure that extends two-squared graphs)
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5
mygraph arc insert node1 node2 "node1 node2"
@@ -1675,7 +1675,7 @@
#Used by:
#Unweighted k-center 2-approximation algorithm (subprocedure that extends two-squared graphs)
- graph mygraph2
+ struct::graph mygraph2
mygraph2 node insert node1 node2 node3 node4 node5
mygraph2 arc insert node1 node2 "node1 node2"
@@ -1694,7 +1694,7 @@
#Used by:
#Unweighted k-center 2-approximation algorithm (subprocedure that extends two-squared graphs)
- graph mygraph2
+ struct::graph mygraph2
mygraph2 node insert node1 node2 node3 node4 node5 node6 node7 node8
@@ -1722,7 +1722,7 @@
#Weighted k-center 3-approximation algorithm
upvar 1 nodeWeights nW
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6 node7 node8
mygraph arc insert node1 node2
@@ -1749,7 +1749,7 @@
upvar 1 nodeWeights nW
- graph mygraph
+ struct::graph mygraph
mygraph node insert node1 node2 node3 node4 node5 node6
mygraph arc insert node1 node6
@@ -1799,7 +1799,7 @@
#Dinic's Algorithm for maximum flow computation
#Subprocedures of above: MKM and Dinic's algorithms for blocking flow finding
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 v3 v4 t
@@ -1847,7 +1847,7 @@
#Dinic's Algorithm for maximum flow computation
#Subprocedures of above: MKM and Dinic's algorithms for blocking flow finding
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d
@@ -1876,7 +1876,7 @@
#Dinic's Algorithm for maximum flow computation
#Subprocedures of above: MKM and Dinic's algorithms for blocking flow finding
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 v3 t
@@ -2069,7 +2069,7 @@
upvar 1 $_f f $_path path
- graph mygraph
+ struct::graph mygraph
mygraph node insert s a b c t
@@ -2207,7 +2207,7 @@
#Used by:
#Busacker Gowen Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s a b c t
@@ -2258,7 +2258,7 @@
#Busacker Gowen Algorithm
#Edmond's Karp Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 t
mygraph arc insert v1 s v1s
@@ -2280,7 +2280,7 @@
#sink node t doesn't exist
#Used by Busacker - Gowen
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 t
mygraph arc insert v1 s v1s
@@ -2307,7 +2307,7 @@
#Minimum Diameter Spanning Tree Algorithm
#BFS algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d e f g h i j
@@ -2333,7 +2333,7 @@
#Used by:
#Minimum Degree Spanning Tree Tests
- graph mygraph
+ struct::graph mygraph
mygraph node insert v1 v2 v3 v4 v5 v6 v7 v8
mygraph arc insert v1 v2 12
@@ -2357,7 +2357,7 @@
#Used by:
#Minimum Diameter Spanning Tree Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d e
mygraph arc insert a b ab
@@ -2392,7 +2392,7 @@
#Used by:
#Minimum Diameter Spanning Tree Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d e
mygraph arc insert a b ab
mygraph arc insert b c bc
@@ -2412,7 +2412,7 @@
#Used by:
#Minimum Degree Spanning Tree Tests
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d e f g
mygraph arc insert a b ab
@@ -2438,7 +2438,7 @@
#Used by:
#Minimum Degree Spanning Tree Tests
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d e f
mygraph arc insert a b ab
@@ -2466,7 +2466,7 @@
#Dinic's Blocking Flow Algorithm
#MKM (3 Hindu) Blocking Flow Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 v3 v4 v5 v6 v7 t
@@ -2517,7 +2517,7 @@
#Dinic's Blocking Flow Algorithm
#MKM (3 Hindu) Blocking Flow Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 v3 v4 t
@@ -2560,7 +2560,7 @@
#Dinic's Blocking Flow Algorithm
#MKM (3 Hindu) Blocking Flow Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 v3 v4 t
@@ -2602,7 +2602,7 @@
#Dinic's Blocking Flow Algorithm
#MKM (3 Hindu) Blocking Flow Algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s v1 v2 v3 v4 t
@@ -2636,7 +2636,7 @@
#BFS algorithm
#Shortest Pathfinding by BFS algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s a b c d x
mygraph arc insert s a sa
@@ -2665,7 +2665,7 @@
#BFS algorithm
#Shortest Pathfinding by BFS algorithm
- graph mygraph
+ struct::graph mygraph
mygraph node insert s a b c d t
mygraph arc insert s d sd
@@ -2704,7 +2704,7 @@
#TSP heuristics of local searching - 2 approximation algorithm
upvar $C _C
- graph mygraph
+ struct::graph mygraph
mygraph node insert a b c d e
mygraph arc insert a b ab
Index: graph/tests/Xsetup
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/graph/tests/Xsetup,v
retrieving revision 1.3
diff -w -u -r1.3 Xsetup
--- graph/tests/Xsetup 21 Sep 2009 23:48:03 -0000 1.3
+++ graph/tests/Xsetup 2 Nov 2009 22:37:02 -0000
@@ -15,8 +15,6 @@
# -------------------------------------------------------------------------
-namespace import -force struct::graph
-
::tcltest::testConstraint graph_critcl [string equal $impl critcl]
switch -exact -- $setimpl {
Index: graph/tests/Xsupport
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/graph/tests/Xsupport,v
retrieving revision 1.3
diff -w -u -r1.3 Xsupport
--- graph/tests/Xsupport 21 Sep 2009 23:48:03 -0000 1.3
+++ graph/tests/Xsupport 2 Nov 2009 22:37:02 -0000
@@ -144,7 +144,7 @@
proc SETUP {{g mygraph}} {
catch {$g destroy}
- graph $g
+ struct::graph $g
}
#----------------------------------------------------------------------
Index: graph/tests/arcs.test
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/graph/tests/arcs.test,v
retrieving revision 1.3
diff -w -u -r1.3 arcs.test
--- graph/tests/arcs.test 15 Sep 2009 04:00:52 -0000 1.3
+++ graph/tests/arcs.test 2 Nov 2009 22:37:02 -0000
@@ -313,7 +313,7 @@
}
test graph-${impl}-${setimpl}-arcs-adj-1.0 {arcs -adj, border case C code failure} -setup {
- graph mygraph
+ struct::graph mygraph
mygraph node insert E
mygraph node insert F
mygraph arc insert E F E_F
Index: graph/tests/command.test
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/graph/tests/command.test,v
retrieving revision 1.5
diff -w -u -r1.5 command.test
--- graph/tests/command.test 24 Sep 2009 16:23:47 -0000 1.5
+++ graph/tests/command.test 2 Nov 2009 22:37:02 -0000
@@ -13,19 +13,19 @@
test graph-${impl}-${setimpl}-create-1.1 {graph create, copy, wrong#args, missing} {
catch {mygraph destroy}
- catch {graph mygraph =} result
+ catch {struct::graph mygraph =} result
set result
} {wrong # args: should be "graph ?name ?=|:=|as|deserialize source??"}
test graph-${impl}-${setimpl}-create-1.2 {graph create, copy, wrong#args, too many} {
catch {mygraph destroy}
- catch {graph mygraph = a b} result
+ catch {struct::graph mygraph = a b} result
set result
} {wrong # args: should be "graph ?name ?=|:=|as|deserialize source??"}
test graph-${impl}-${setimpl}-create-1.3 {graph create, copy, unknown operator} {
catch {mygraph destroy}
- catch {graph mygraph foo a} result
+ catch {struct::graph mygraph foo a} result
set result
} {wrong # args: should be "graph ?name ?=|:=|as|deserialize source??"}
@@ -34,13 +34,13 @@
test graph-${impl}-${setimpl}-create-2.0 {graph create, duplicate, graph} {
SETUP
- catch {graph mygraph} msg
+ catch {struct::graph mygraph} msg
mygraph destroy
set msg
} "command \"::mygraph\" already exists, unable to create graph"
test graph-${impl}-${setimpl}-create-2.1 {graph create, duplicate, non-graph} {
- catch {graph set} msg
+ catch {struct::graph set} msg
set msg
} "command \"::set\" already exists, unable to create graph"
@@ -55,7 +55,7 @@
} 1
test graph-${impl}-${setimpl}-create-3.1 {graph create, auto-generation of name} {
- set name [graph]
+ set name [struct::graph]
set result [list \
[string match ::graph* $name] \
[string equal [info commands $name] "$name"]]
@@ -73,7 +73,7 @@
catch {mygraph destroy}
set serial {%3 {} {{f 6 {}}} %0 {foo bar} {{a 6 {}} {b 9 {bar snarf}} {c 0 {}}} %1 {} {{d 9 {}}} %2 {} {{e 0 {}}} {data foo}}
- graph mygraph deserialize $serial
+ struct::graph mygraph deserialize $serial
set result [validate_serial mygraph $serial]
mygraph destroy
@@ -84,8 +84,8 @@
catch {mygraph destroy}
set serial {%3 {} {{f 6 {}}} %0 {foo bar} {{a 6 {}} {b 9 {bar snarf}} {c 0 {}}} %1 {} {{d 9 {}}} %2 {} {{e 0 {}}} {data foo}}
- graph mygraph deserialize $serial
- graph bgraph = mygraph
+ struct::graph mygraph deserialize $serial
+ struct::graph bgraph = mygraph
set result [validate_serial bgraph $serial]
mygraph destroy
@@ -98,8 +98,8 @@
catch {mygraph destroy}
set serial {%3 {} {{f 6 {}}} %0 {foo bar} {{a 6 {}} {b 9 {bar snarf}} {c 0 {} 222}} %1 {} {{d 9 {}}} %2 {} {{e 0 {} 444}} {data foo}}
- graph mygraph deserialize $serial
- graph bgraph = mygraph
+ struct::graph mygraph deserialize $serial
+ struct::graph bgraph = mygraph
set result [validate_serial bgraph $serial]
mygraph destroy
@@ -112,8 +112,8 @@
catch {mygraph destroy}
set serial {{}}
- graph mygraph deserialize $serial
- graph bgraph = mygraph
+ struct::graph mygraph deserialize $serial
+ struct::graph bgraph = mygraph
set result [validate_serial bgraph $serial]
mygraph destroy