in reply to Inversion list prototype
The initial code was brittle as hell, in that it was hard to fix a bug without introducing others. I'd *really* recommend a good set of unit tests for this data type.
There are a lot of different cases to consider, with edge cases where the ends of the unions are equal, overlap in different ways, are subsets, proper subsets etc.
However, I've also written some related code (not identical, this is for a half open interval, so the top endpoint isn't included) as part of exmap. If you're interested, it's Range.cpp/Range.hpp in there, with the tests in t_range.cpp.
In fact now I come to think of it, there's a perl version in there too, in the perl-deprecated directory, "Range.pm and test-range.pl".
If it's of any use, lift anything you like from that tarball. That project is GPL'd. (If you'd like it under Artistic License let me know, I'm the author and can re-license if required).
(Edit - can you steal the unit tests from Algorithm::InversionList? It's often quite easy to translate unit tests from one language to another)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inversion list prototype
by demerphq (Chancellor) on Feb 16, 2007 at 17:43 UTC | |
by jbert (Priest) on Feb 16, 2007 at 18:08 UTC | |
by demerphq (Chancellor) on Feb 16, 2007 at 18:19 UTC |