# -*- tcl -*- # Graph tests - graph/arc/node keyexists (attribute keyexists) # Copyright (c) 2006 Andreas Kupries # All rights reserved. # RCS: @(#) $Id: keyexists.test,v 1.3 2008/03/07 06:51:39 andreas_kupries Exp $ # Syntax: graph keyexists KEY # Syntax: graph arc keyexists ARC KEY # Syntax: graph node keyexists 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}-keyexists-1.0 "$e keyexists, wrong # args, missing" { SETUP catch {CMD keyexists} msg mygraph destroy set msg } [tmWrongA "${mp}keyexists" "${mp}key" 0] ; # {} test graph-${impl}-${setimpl}-${e}-keyexists-1.1 "$e keyexists, wrong # args, missing" !graph { SETUP catch {CMD keyexists a} msg mygraph destroy set msg } [tmWrongA "${mp}keyexists" "${mp}key" 1] ; # {} test graph-${impl}-${setimpl}-${e}-keyexists-1.2 "$e keyexists, wrong # args, too many" { SETUP catch {CMD keyexists a b c} msg mygraph destroy set msg } [tmTooManyA "${mp}keyexists" "${mp}key"] ; # {} # ------------------------------------------------------------------------- # Logical arguments checks and failures test graph-${impl}-${setimpl}-${e}-keyexists-2.0 "$e keyexists, missing $e" !graph { SETUP catch {Keyexists$ex foo} msg mygraph destroy set msg } [Missing$ex $MY x] ; # {} # ------------------------------------------------------------------------- # Ok arguments. test graph-${impl}-${setimpl}-${e}-keyexists-3.0 "$e keyexists, no attributes" { SETUP $ex set result [Keyexists$ex bogus] mygraph destroy set result } 0 ; # {} test graph-${impl}-${setimpl}-${e}-keyexists-3.1 "$e keyexists, missing key" { SETUP $ex SetW$ex ok "" set result [Keyexists$ex bogus] mygraph destroy set result } 0 ; # {} test graph-${impl}-${setimpl}-${e}-keyexists-3.2 "$e keyexists, existing key" { SETUP $ex SetW$ex ok "" set result [Keyexists$ex ok] mygraph destroy set result } 1 ; # {} } # -------------------------------------------------------------------------