head	1.4;
access;
symbols
	tcllib-1-13:1.4
	tcllib-1-12:1.4
	tklib-0-5:1.2
	tcllib-1-11-1:1.2
	tcllib-1-11:1.2
	tcllib-1-10:1.1;
locks; strict;
comment	@# @;


1.4
date	2009.11.03.17.38.30;	author andreas_kupries;	state Exp;
branches;
next	1.3;

1.3
date	2009.09.21.23.48.03;	author andreas_kupries;	state Exp;
branches;
next	1.2;

1.2
date	2008.03.07.06.51.36;	author andreas_kupries;	state Exp;
branches;
next	1.1;

1.1
date	2006.11.16.06.33.13;	author andreas_kupries;	state Exp;
branches;
next	;


desc
@@


1.4
log
@
	* graph/tests/XOpsSetup: [Bug 2811747]: Removed the import of
	* graph/tests/Xsetup: command struct::graph into the global
	* graph/tests/Xsupport: namespace in the testsuite, and updated
	* graph/tests/arcs.test: all users. This prevents the masking
	* graph/tests/command.test: of scope errors in the graph::op
	* graph1.test: package when its testsuite is run.
@
text
@# -*- tcl -*-
# graph.testsuite.setup:  Setting up implementation specific definitions.
#
# Copyright (c) 2006 Andreas Kupries <andreas_kupries@@users.sourceforge.net>
# All rights reserved.
#
# RCS: @@(#) $Id: Xsetup,v 1.3 2009/09/21 23:48:03 andreas_kupries Exp $

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

# tmWrong   - wrong#args generation, missing arguments
# tmTooMany - wrong#args generation, too many arguments
# MY        - variable holding the name of the graph instance found in
#             error messages.

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

::tcltest::testConstraint graph_critcl [string equal $impl critcl]

switch -exact -- $setimpl {
    critcl {
	proc tmSE {tcl critcl} {return $critcl}
    }
    tcl {
	proc tmSE {tcl critcl} {return $tcl}
    }
}

switch -exact -- $impl {
    critcl {
	set MY mygraph

	proc tmWrong {m loarg n {xarg {}}} {
	    return [tcltest::wrongNumArgs "mygraph $m" $loarg $n]
	}

	proc tmTooMany {m loarg {xarg {}}} {
	    return [tcltest::tooManyArgs "mygraph $m" $loarg]
	}

	proc tmE {tcl critcl} {return $critcl}

	if {[package vsatisfies [package present Tcl] 8.5]} {
	    proc tmWrongA {m loarg n {xarg {}}} {
		if {[llength $m] > 1} {set m [lindex $m 1]}
		return [tcltest::wrongNumArgs "CMD $m" $loarg $n]
	    }

	    proc tmTooManyA {m loarg {xarg {}}} {
		if {[llength $m] > 1} {set m [lindex $m 1]}
		return [tcltest::tooManyArgs "CMD $m" $loarg]
	    }
	} else {
	    proc tmWrongA {m loarg n {xarg {}}} {
		return [tcltest::wrongNumArgs "mygraph $m" $loarg $n]
	    }

	    proc tmTooManyA {m loarg {xarg {}}} {
		return [tcltest::tooManyArgs "mygraph $m" $loarg]
	    }
	}
    }
    tcl {
	set MY ::mygraph

	proc tmWrong {m loarg n {xarg {}}} {
	    if {$xarg == {}} {set xarg $loarg}
	    if {$xarg != {}} {set xarg " $xarg"}
	    if {[llength $m] > 1} {set m _[join $m _]}
	    incr n
	    return [tcltest::wrongNumArgs "::struct::graph::_$m" "name$xarg" $n]
	}

	proc tmTooMany {m loarg {xarg {}}} {
	    if {$xarg == {}} {set xarg $loarg}
	    if {$xarg != {}} {set xarg " $xarg"}
	    if {[llength $m] > 1} {set m _[join $m _]}
	    return [tcltest::tooManyArgs "::struct::graph::_$m" "name$xarg"]
	}

	proc tmWrongA {m loarg n {xarg {}}} {
	    if {$xarg == {}} {set xarg $loarg}
	    if {$xarg != {}} {set xarg " $xarg"}
	    if {[llength $m] > 1} {set m _[join $m _]}
	    incr n
	    return [tcltest::wrongNumArgs "::struct::graph::_$m" "name$xarg" $n]
	}

	proc tmTooManyA {m loarg {xarg {}}} {
	    if {$xarg == {}} {set xarg $loarg}
	    if {$xarg != {}} {set xarg " $xarg"}
	    if {[llength $m] > 1} {set m _[join $m _]}
	    return [tcltest::tooManyArgs "::struct::graph::_$m" "name$xarg"]
	}

	proc tmE {tcl critcl} {return $tcl}
    }
}

# -------------------------------------------------------------------------
@


1.3
log
@
	* graph/tests/XOpsControl: Added the testsuites for metrictsp,
	  christofides and tspheuristics.
	* graph/tests/ops/metrictsp.test: Testsuite for metrictsp.
	* graph/tests/ops/christofides.test: Testsuite for christofides.
	* graph/tests/ops/tspheuristics.test: Testsuite for tspheuristics.
	  Changes compared to GSoC result:
	  - Test names extended with 'treeimpl'.
	  - Indentation, line-endings
	  - Conversion to v2 syntax, and cleanup of resource handling.
	  - Updated results for different implementations, sorting.

	* graph/tests/XOpsSetup (SETUP_TSPHEURISTIC_1): Fixed growing
	  cycle list throwing of repeated execution of the same test.

	* graph/tests/Xsupport: Added helper commands for the test cases
	  of the various metric tsp commands (canonical tours, ...).

	* graph/tests/Xsetup (tmSE): Added result selection based on
	  implementation of struct::set.

	* graphops.tcl (::struct::graph::op::MetricTravellingSalesman):
	  Fixed problem in algorithm for asymmetric TSP, selecting the
	  tour in the wrong (higher-weight) direction. The Fleury
	  underneath does not care about arc direction.
	  (::struct::graph::op::Christofides): Dropped superfluous
	  variable and fixed M+T operation. The matching does not care
	  about arc direction, and we have insert anti-parallel arcs to
	  avoid any existing.
	  (::struct::graph::op::isEulerian?): Extended API to return
	  tour start. Computable from the arcs, but not easy. Better to get
	  it from the algorithm which knows by definition.
	  (::struct::graph::op::findHamiltonCycle): Get tour start from
	  isEulerian, and drop bogus computation from the tour arcs.
	  (::struct::graph::op::createTGraph): Moved graph creation after
	  error check to avoid a leak when the check fails.
	* graphops.man: Bumped version to 0.11
	* pkgIndex.tcl: (isEulerian API extension, plus bugfixes).
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: Xsetup,v 1.2 2008/03/07 06:51:36 andreas_kupries Exp $
a17 2
namespace import -force struct::graph

@


1.2
log
@
	* sets.test: Updated tests to have error messages in line with the
	* graph/tests/Xsetup: 8.5 core.
	* graph/tests/attr/append.test:
	* graph/tests/attr/get.test:
	* graph/tests/attr/getall.test:
	* graph/tests/attr/keyexists.test:
	* graph/tests/attr/keys.test:
	* graph/tests/attr/lappend.test:
	* graph/tests/attr/set.test:
	* graph/tests/attr/unset.test:
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: Xsetup,v 1.1 2006/11/16 06:33:13 andreas_kupries Exp $
d22 9
@


1.1
log
@
	* pkgIndex.tcl: Version of graph bumped to 2.2.

	* graph.man: Updated documentation for new features, extended
	  abilities, critcl implementation, etc.

	* graph.tcl:     Changed core graph code to support multiple
	* graph_tcl.tcl: implementations, and Tcl implementation. Added
	  some more features (arc|node delete multiple nodes, insertion of
	  multiple nodes, flipping the direction of arcs), internal
	  refactoring of common argument checks, additional checks closing
	  some holes.

	* graph_c.tcl: Critcl based implementation of graph.
	* graph/arc.c:
	* graph/methods.c:
	* graph/ds.h:
	* graph/node.c:
	* graph/objcmd.h:
	* graph/attr.c:
	* graph/arcshimmer.c:
	* graph/objcmd.c:
	* graph/arc.h:
	* graph/filter.c:
	* graph/methods.h:
	* graph/util.c:
	* graph/util.h:
	* graph/node.h:
	* graph/graph.h:
	* graph/graph.c:
	* graph/nacommon.c:
	* graph/walk.c:
	* graph/walk.h:
	* graph/global.h:
	* graph/nodeshimmer.c:
	* graph/attr.h:
	* graph/global.c:
	* graph/nacommon.h:

	* graph.test: Reworked testsuite, split into about one file per
	* graph/tests/Xsetup: tested method, plus helper and control
	* graph/tests/arc/delete.test: files. Extended testsuite testing
	* graph/tests/arc/exists.test: several of the holes which were
	* graph/tests/arc/flip.test: closed and had never been tested
	* graph/tests/arc/insert.test: before.
	* graph/tests/arc/move.test:
	* graph/tests/arc/move-source.test:
	* graph/tests/arc/move-target.test:
	* graph/tests/arc/rename.test:
	* graph/tests/arc/source.test:
	* graph/tests/arc/target.test:
	* graph/tests/arc/attr.test:
	* graph/tests/attr/get.test:
	* graph/tests/attr/getall.test:
	* graph/tests/attr/keyexists.test:
	* graph/tests/attr/keys.test:
	* graph/tests/attr/lappend.test:
	* graph/tests/attr/set.test:
	* graph/tests/attr/unset.test:
	* graph/tests/attr/append.test:
	* graph/tests/attr/Xsetup:
	* graph/tests/node/degree.test:
	* graph/tests/node/delete.test:
	* graph/tests/node/exists.test:
	* graph/tests/node/insert.test:
	* graph/tests/node/rename.test:
	* graph/tests/node/opposite.test:
	* graph/tests/node/attr.test:
	* graph/tests/walk.test:
	* graph/tests/Xsupport:
	* graph/tests/Xcontrol:
	* graph/tests/arcs.test:
	* graph/tests/nodes.test:
	* graph/tests/deserialize.test:
	* graph/tests/assign.test:
	* graph/tests/serialize.test:
	* graph/tests/command.test:
	* graph/tests/rassign.test:
	* graph/tests/swap.test:
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: graph.test,v 1.25 2006/10/09 21:41:42 andreas_kupries Exp $
d35 20
d74 15
@

