|
Boost : |
From: rogeeff (rogeeff_at_[hidden])
Date: 2002-01-28 14:46:08
--- In boost_at_y..., "johnrpanzer" <jpanzer_at_n...> wrote:
> All,
>
> Many moons ago, I asked if there would be any interest
> in something to do runtime concept checking (at least
> for ordering predicates). One or two people expressed
> some mild curiosity, so as part of my New Year's resolutions,
> I've uploaded a draft implementation of an ordering
> predicate checker to:
>
> http://groups.yahoo.com/group/boost/files/test_strict_weak_ordering/
>
> Example:
>
> less_equal<T> is not a Strict Weak Ordering. The code:
>
> int intdata[] = {3, 5, 8 , 29, 872, 5839};
> assert(test_strict_weak_ordering(less_equal<int>(),
> intdata,intdata+6));
>
> will produce output like:
>
> Predicate fails irreflexivity; a<a not allowed:#0=3
> Predicate fails irreflexivity; a<a not allowed: #1=5
> ...
> Predicate fails antisymmetry; a<b and b<a: #0=3, #0=3
> Predicate fails antisymmetry; a<b and b<a: #1=5, #1=5
> ...
> assertion failed, line 15: ...
>
>
> Please let me know what you think.
>
> Regards,
> John Panzer
> jpanzer_at_n...
> jpanzer_at_a...
We could add this as unit test framework extention. But,
1. Why this algorithm?
2. What other algorithms we may consider?
3. Who are intended users for this?
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk