# -*- 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
}

# ---------------------------------------------------
