Boost logo

Boost :

From: jpanzer_at_[hidden]
Date: 2002-01-29 13:00:12


Ah! OK, I understand. test_strict_weak_ordering does an exhaustive test of all the input values against
each other using the functor, and the original order of the input doesn't matter. If the input contains
all possible values for value_type, then test_strict_weak_ordering will give a definitive yes/no answer.

Otherwise, and for most real-world cases, it will give a false positive if the input doesn't contain a
case that causes a failure (a true return just means that it can't prove the functor is broken). So the
quality of the answer depends on the quality of the input; this is the usual test data problem. So there
isn't really a precondition, but rather a tradeoff between exhaustiveness of testing and certainty of
correctness. There are some things to keep in mind:

- There's no reason to repeat exact values, but it can be helpful to have some equivalent values (where
equivalence is defined in terms of the comparison functor).
- Using representative input is important.
- Edge cases are good tests, but requires detailed knowledge of how the comparison works.

John Panzer

Jeremy Siek wrote:

> In addition to the compile-time requirements, I bet there are also some
> run time requirements. For example, a list of the same object over and
> over again probably wouldn't work for input, right?
>
> On Mon, 28 Jan 2002 jpanzer_at_[hidden] wrote:
> > Hi Jeremy-
> >
> > The value_type must be copy constructible and (of course) must be
> > compatible with the argument types of the predicate under test.
> > Also, for this version, it must have some appropriate operator<<
> > defined for stream output. (All the requirements are detailed in the
> > header file in this draft. If this proves to be of interest, I'm sure
> > the last requirement can be made optional.)
> >
> > -John
> >
> > Jeremy Siek wrote:
> >
> > > Hi John,
> > >
> > > This is great!
> > >
> > > BTW, I assume that there are some preconditions on the data set. What are
> > > they?
> > >
> > > On Mon, 28 Jan 2002, johnrpanzer wrote:
> > > jpanze> All,
> > > jpanze>
> > > jpanze> Many moons ago, I asked if there would be any interest
> > > jpanze> in something to do runtime concept checking (at least
> > > jpanze> for ordering predicates). One or two people expressed
> > > jpanze> some mild curiosity, so as part of my New Year's resolutions,
> > > jpanze> I've uploaded a draft implementation of an ordering
> > > jpanze> predicate checker to:
> > > jpanze>
> > > jpanze> http://groups.yahoo.com/group/boost/files/test_strict_weak_ordering/
> > > ...
> >
> >
> > Info: http://www.boost.org Send unsubscribe requests to: <mailto:boost-unsubscribe_at_[hidden]>
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
>
> ----------------------------------------------------------------------
> Jeremy Siek http://www.osl.iu.edu/~jsiek/
> Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
> C++ Booster (http://www.boost.org) office phone: (812) 855-3608
> ----------------------------------------------------------------------
>
> Info: http://www.boost.org Send unsubscribe requests to: <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk