Re: Does tcltest2.2 have a set equivalence-relation?
From: Bob Techentin (techentin.robert_at_mayo.edu)
Date: 10/02/03
- Next message: mitch: "Re: performance Winxp vs Linux"
- Previous message: Georgios Petasis: "TIP #159: Extending Tk 'wm' Command to Support Coloured Icons"
- In reply to: Cameron Laird: "Does tcltest2.2 have a set equivalence-relation?"
- Next in thread: Dossy: "Re: Does tcltest2.2 have a set equivalence-relation?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 2 Oct 2003 10:53:16 -0500
"Cameron Laird" <claird@lairds.com> wrote
>
> In coding terms, the situation is this: suppose I write
> test array_names {Note that order isn't guaranteed} {
> set a(1) one_thing
> set a(2) another
> array names a
> } {1 2}
> What I *really* want the answer to be is "{1 2} OR {2 1}, that is,
call
> the lists equal if they're equal as 'sets' or 'bags' or
'collections'."
> Does tcltest give me a succinct way to express that?
Cameron,
It looks like you could use customMatch to define an out-of-order list
matching script, then use the -match switch on your test. I've never
tried it, but as I look at the docs, it appears to be one of those
enormously flexible options that is just dying to be exploited.
Or, if you want to solve just this specific case , just change the
test script to return [lsort [array names x]]. Throw in a -unique
flag if you want a 'bag' comparison.
Bob
-- Bob Techentin techentin.robert@NOSPAMmayo.edu Mayo Foundation (507) 538-5495 200 First St. SW FAX (507) 284-9171 Rochester MN, 55901 USA http://www.mayo.edu/sppdg/
- Next message: mitch: "Re: performance Winxp vs Linux"
- Previous message: Georgios Petasis: "TIP #159: Extending Tk 'wm' Command to Support Coloured Icons"
- In reply to: Cameron Laird: "Does tcltest2.2 have a set equivalence-relation?"
- Next in thread: Dossy: "Re: Does tcltest2.2 have a set equivalence-relation?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|