1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
# -*- tcl -*-
# Graph ops tests - Dijkstra, distances, diameter
# Copyright (c) 2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
# RCS: @(#) $Id: diameter.test,v 1.2 2009/09/15 19:24:12 andreas_kupries Exp $
# Syntax: struct::graph::op::diameter G ?options?
# -------------------------------------------------------------------------
# Wrong # args: Missing, Too many
test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-diameter-1.0 {diameter, wrong args, missing} {
catch {struct::graph::op::diameter} msg
set msg
} [tcltest::wrongNumArgs struct::graph::op::diameter {g args} 0]
# -------------------------------------------------------------------------
# Logical arguments checks and failures
# -------------------------------------------------------------------------
# Ok arguments.
set n 0
foreach {setup diameter undiameter} {
SETUP_A Inf 8
SETUP_B Inf 6
} {
test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-diameter-3.$n "diameter, $setup/$node, directed" {
$setup
set result [struct::graph::op::diameter mygraph -arcmode directed]
mygraph destroy
set result
} $diameter
test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-diameter-4.$n "diameter, $setup/$node, undirected" {
$setup
set result [struct::graph::op::diameter mygraph -arcmode undirected]
mygraph destroy
set result
} $undiameter
incr n
}
# ---------------------------------------------------
|