# -*- tcl -*- # Graph tests - graph/arc/node get (attribute get) # Copyright (c) 2006 Andreas Kupries # All rights reserved. # RCS: @(#) $Id: get.test,v 1.3 2008/03/07 06:51:36 andreas_kupries Exp $ # Syntax: graph get KEY # Syntax: graph arc get ARC KEY # Syntax: graph node get NODE KEY # ------------------------------------------------------------------------- foreach {e ex stem mp mk} { arc Arc {mygraph arc} {arc } x node Node {mygraph node} {node } x graph Graph {mygraph} {} {} } { AttrSetup # ------------------------------------------------------------------------- # Wrong # args: Missing, Too many test graph-${impl}-${setimpl}-${e}-get-1.0 "$e get, wrong#args, missing" { SETUP catch {CMD get} msg mygraph destroy set msg } [tmWrongA "${mp}get" "${mp}key" 0] ; # {} test graph-${impl}-${setimpl}-${e}-get-1.1 "$e get, wrong#args, missing" !graph { SETUP catch {CMD get x} msg mygraph destroy set msg } [tmWrongA "${mp}get" "${mp}key" 1] ; # {} test graph-${impl}-${setimpl}-${e}-get-1.2 "$e get, wrong#args, too many" { SETUP catch {CMD get x y z} msg mygraph destroy set msg } [tmTooManyA "${mp}get" "${mp}key"] ; # {} # ------------------------------------------------------------------------- # Logical arguments checks and failures test graph-${impl}-${setimpl}-${e}-get-2.0 "$e get, missing $e" !graph { SETUP catch {Get$ex data} msg mygraph destroy set msg } [Missing$ex $MY x] ; # {} test graph-${impl}-${setimpl}-${e}-get-2.1 "$e get, no attributes" { SETUP $ex catch {Get$ex bogus} msg mygraph destroy set msg } [MissingKey $mk $e bogus] ; # {} test graph-${impl}-${setimpl}-${e}-get-2.2 "$e get, missing key" { SETUP $ex SetW$ex foo far catch {Get$ex bogus} msg mygraph destroy set msg } [MissingKey $mk $e bogus] ; # {} # ------------------------------------------------------------------------- # Ok arguments. test graph-${impl}-${setimpl}-${e}-get-2.4 "$e get" { SETUP $ex SetW$ex boom foobar set result [Get$ex boom] mygraph destroy set result } foobar ; # {} } # -------------------------------------------------------------------------