Tk Library Source Code

Artifact [2b7992456c]
Login

Artifact 2b7992456c0e056fa4eb65f7f13bd2cb1e32e75c:

Attachment "graph.test.patch" to ticket [552972ffff] added by andreas_kupries 2002-05-09 12:48:42. Also attachment "graph.test.patch" to ticket [552968ffff] added by cleverly 2002-05-07 01:35:11.
*** graph.test	Fri Jun 16 14:15:32 2000
--- graph-modified.test	Wed Jan 16 15:22:31 2002
***************
*** 1136,1141 ****
--- 1136,1504 ----
  	leave mygraph viii leave mygraph   i leave mygraph   ix	\
  	]
  
+ test graph-22.1 {arc getall gives error on bogus arc} {
+     graph mygraph
+     catch {mygraph arc getall arc0} msg
+     mygraph destroy
+     set msg
+ } "arc \"arc0\" does not exist in graph \"mygraph\""
+ test graph-22.2 {arc getall gives error when key specified} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     catch {mygraph arc getall arc0 -key data} msg
+     mygraph destroy
+     set msg
+ } "Wrong # arguments given to 'getall'"
+ test graph-22.3 {arc getall with node name returns list of key/value pairs} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 foobar
+     mygraph arc set arc0 -key other thing
+     set results [mygraph arc getall arc0]
+     mygraph destroy
+     lsort $results
+ } "data foobar other thing"   
+ 
+ test graph-23.1 {node getall gives error on bogus node} {
+     graph mygraph
+     catch {mygraph node getall node0} msg
+     mygraph destroy
+     set msg
+ } "node \"node0\" does not exist in graph \"mygraph\""
+ test graph-23.2 {node getall gives error when key specified} {
+     graph mygraph
+     mygraph node insert node0
+     catch {mygraph node getall node0 -key data} msg
+     mygraph destroy
+     set msg
+ } "Wrong # arguments given to 'getall'"
+ test graph-23.3 {node getall with node name returns list of key/value pairs} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 foobar
+     mygraph node set node0 -key other thing
+     set results [mygraph node getall node0]
+     mygraph destroy
+     lsort $results
+ } "data foobar other thing"   
+ 
+ test graph-24.1 {arc keys gives error on bogus arc} {
+     graph mygraph
+     catch {mygraph arc keys arc0} msg
+     mygraph destroy
+     set msg
+ } "arc \"arc0\" does not exist in graph \"mygraph\""
+ test graph-24.2 {arc keys gives error when key specified} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     catch { mygraph arc keys arc0 -key bogus } msg
+     mygraph destroy
+     set msg
+ } "Wrong # arguments given to 'keys'"
+ test graph-24.3 {arc keys with arc name returns list of keys} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 -key other things
+     set results [mygraph arc keys arc0]
+     mygraph destroy
+     lsort $results
+ } "data other"
+   
+ test graph-25.1 {node keys gives error on bogus node} {
+     graph mygraph
+     catch {mygraph node keys node0} msg
+     mygraph destroy
+     set msg
+ } "node \"node0\" does not exist in graph \"mygraph\""
+ test graph-25.2 {node keys gives error when key specified} {
+     graph mygraph
+     mygraph node insert node0
+     catch { mygraph node keys node0 -key bogus } msg
+     mygraph destroy
+     set msg
+ } "Wrong # arguments given to 'keys'"
+ test graph-25.3 {node keys with node name returns list of keys} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 -key other things
+     set results [mygraph node keys node0]
+     mygraph destroy
+     lsort $results
+ } "data other"
+ 
+ test graph-26.1 {arc keyexists gives error on bogus arc} {
+     graph mygraph
+     catch {mygraph arc keyexists arc0} msg
+     mygraph destroy
+     set msg
+ } "arc \"arc0\" does not exist in graph \"mygraph\""
+ test graph-26.2 {arc keyexists returns false on non-existant key} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     set result [mygraph arc keyexists arc0 -key bogus]
+     mygraph destroy
+     set result
+ } "0"
+ test graph-26.3 {arc keyexists uses data as default key} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     set result [mygraph arc keyexists arc0]
+     mygraph destroy
+     set result
+ } "1"
+ test graph-26.4 {arc keyexists respects -key flag} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 -key boom foobar
+     set result [mygraph arc keyexists arc0 -key boom]
+     mygraph destroy
+     set result
+ } "1"
+ 
+ test graph-27.1 {node keyexists gives error on bogus node} {
+     graph mygraph
+     catch {mygraph node keyexists node0} msg
+     mygraph destroy
+     set msg
+ } "node \"node0\" does not exist in graph \"mygraph\""
+ test graph-27.2 {node keyexists returns false on non-existant key} {
+     graph mygraph
+     mygraph node insert node0
+     set result [mygraph node keyexists node0 -key bogus]
+     mygraph destroy
+     set result
+ } "0"
+ test graph-27.3 {node keyexists uses data as default key} {
+     graph mygraph
+     mygraph node insert node0
+     set result [mygraph node keyexists node0]
+     mygraph destroy
+     set result
+ } "1"
+ test graph-27.4 {node keyexists respects -key flag} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 -key boom foobar
+     set result [mygraph node keyexists node0 -key boom]
+     mygraph destroy
+     set result
+ } "1"
+ 
+ test graph-28.1 {arc append gives error on bogus arc} {
+     graph mygraph
+     catch {mygraph arc append arc0} msg
+     mygraph destroy
+     set msg
+ } "arc \"arc0\" does not exist in graph \"mygraph\""
+ test graph-28.2 {arc append with arc name appends to "data" value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 foo
+     set result [mygraph arc append arc0 bar]
+     mygraph destroy
+     set result
+ } "foobar"
+ test graph-28.3 {arc append with arc name and key appends key value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 -key baz foo
+     set result [mygraph arc append arc0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foobar"
+ test graph-28.4 {arc append with too many args gives error} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     catch {mygraph arc append arc0 foo bar baz boo} msg
+     mygraph destroy
+     set msg
+ } "wrong # args: should be \"mygraph arc append arc0 ?-key key? value\""
+ test graph-28.5 {arc append with bad args} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     catch {mygraph arc append arc0 -foo bar baz} msg
+     mygraph destroy
+     set msg
+ } "invalid option \"-foo\": should be -key"
+ test graph-28.6 {arc append respects -key flag} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 -key baz foo
+     set result [mygraph arc append arc0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foobar"
+ 
+ test graph-29.1 {arc lappend gives error on bogus arc} {
+     graph mygraph
+     catch {mygraph arc lappend arc0} msg
+     mygraph destroy
+     set msg
+ } "arc \"arc0\" does not exist in graph \"mygraph\""
+ test graph-29.2 {arc lappend with node arc lappends to "data" value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 foo
+     set result [mygraph arc lappend arc0 bar]
+     mygraph destroy
+     set result
+ } "foo bar"
+ test graph-29.3 {arc lappend with arc name and key lappends key value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 -key baz foo
+     set result [mygraph arc lappend arc0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foo bar"
+ test graph-29.4 {arc lappend with too many args gives error} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     catch {mygraph arc lappend arc0 foo bar baz boo} msg
+     mygraph destroy
+     set msg
+ } "wrong # args: should be \"mygraph arc lappend arc0 ?-key key? value\""
+ test graph-29.5 {arc lappend with bad args} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     catch {mygraph arc lappend arc0 -foo bar baz} msg
+     mygraph destroy
+     set msg
+ } "invalid option \"-foo\": should be -key"
+ test graph-29.6 {arc lappend respects -key flag} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node insert node1
+     mygraph arc insert node0 node1 arc0
+     mygraph arc set arc0 -key baz foo
+     set result [mygraph arc lappend arc0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foo bar"
+ 
+ test graph-30.1 {node append gives error on bogus node} {
+     graph mygraph
+     catch {mygraph node append node0} msg
+     mygraph destroy
+     set msg
+ } "node \"node0\" does not exist in graph \"mygraph\""
+ test graph-30.2 {node append with node name appends to "data" value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 foo
+     set result [mygraph node append node0 bar]
+     mygraph destroy
+     set result
+ } "foobar"
+ test graph-30.3 {node append with node name and key appends key value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 -key baz foo
+     set result [mygraph node append node0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foobar"
+ test graph-30.4 {node append with too many args gives error} {
+     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 graph-30.5 {node append with bad args} {
+     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 graph-30.6 {node append respects -key flag} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 -key baz foo
+     set result [mygraph node append node0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foobar"
+ 
+ test graph-31.1 {node lappend gives error on bogus node} {
+     graph mygraph
+     catch {mygraph node lappend node0} msg
+     mygraph destroy
+     set msg
+ } "node \"node0\" does not exist in graph \"mygraph\""
+ test graph-32.2 {node lappend with node name lappends to "data" value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 foo
+     set result [mygraph node lappend node0 bar]
+     mygraph destroy
+     set result
+ } "foo bar"
+ test graph-32.3 {node lappend with node name and key lappends key value} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 -key baz foo
+     set result [mygraph node lappend node0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foo bar"
+ test graph-32.4 {node lappend with too many args gives error} {
+     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 graph-32.5 {node lappend with bad args} {
+     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 graph-32.6 {node lappend respects -key flag} {
+     graph mygraph
+     mygraph node insert node0
+     mygraph node set node0 -key baz foo
+     set result [mygraph node lappend node0 -key baz bar]
+     mygraph destroy
+     set result
+ } "foo bar"
+ 
+ 
  # ---------------------------------------------------
    
  ::tcltest::cleanupTests