Code Monkey home page Code Monkey logo

Comments (7)

jeffparsons avatar jeffparsons commented on August 28, 2024

Thanks for the detailed report, @luukvanderduim!

I've just released version 1.0.3 with this issue fixed.

from rangemap.

luukvanderduim avatar luukvanderduim commented on August 28, 2024

Awesome! It looks like fixing this also fixed Psst!

from rangemap.

luukvanderduim avatar luukvanderduim commented on August 28, 2024

It looks like the test mentioned earlier still fails on RangeSet.
For convenience I added a PR with all the test I thought to be relevant to set.

from rangemap.

jeffparsons avatar jeffparsons commented on August 28, 2024

Huh... that's odd. I will pull your branch and take a look when I get a chance — might be a couple of days though. Hopefully the test itself is wrong! 🤞

from rangemap.

jeffparsons avatar jeffparsons commented on August 28, 2024

@luukvanderduim I had a look at the failing test on your branch, and it seems to me that the problem is with the test. I already fixed the definition of that test upstream here: c56ec88#diff-110e61eb735b79c762510f02f157a12094bcf2b9a15d2ed767532a0e3d5f7bafL1122 before releasing version 1.0.3.

I don't think I'll merge the PR, by the way, because RangeSet is little more than a thin wrapper around RangeMap where the value type is () (just like std::collections::BTreeSet is a thin wrapper around BTreeMap). I.e. the tests won't be testing anything interesting on BTreeSet because it's all the same logic that it's testing.

If you're convinced, I'll close this again and also close #49.

from rangemap.

luukvanderduim avatar luukvanderduim commented on August 28, 2024

Oh dear. I clearly wasn't thinking. I see what you mean, of course the test is wrong. Sorry about the noise and thanks for your swift responses!
I will remove the PR!

I like what you did simplifying the gaps iterator. In Psst, with rangemap 1.0.2, it ended up returning ranges where start > end it appears. I suspect that had something to do with the peekable in Gaps. I tried to isolate a case, but could not unfortunately as that would have helped test coverage.

from rangemap.

luukvanderduim avatar luukvanderduim commented on August 28, 2024

Yay! A test case that fails on a rangemap tree at commit 92c5030 (v1.0.2) that has method gaps() yield a 'start > end'-range, where it should have returned None. This is what actually bit Psst, (but is fixed in rangemap 1.0.3,) but is not covered by any existing test.

You might want to consider adding this test (or a generalized version of this case) to prevent a future re-occurrence.

   #[test]
   fn outer_range_has_rangemap_return_start_greater_than_end_gaps() {
       let mut range_set: RangeSet<u64> = RangeSet::new();
       let outer_range: Range<u64> = 6110..268254;

        range_set.insert(144..327828);
        range_set.insert(6092380..6157916);

        let mut gaps = range_set.gaps(&outer_range);

        assert_eq!(gaps.next(), None);
   }

Which fails like this on 1.0.2:

---- set::tests::outer_range_has_rangemap_return_start_greater_than_end_gaps stdout ----
thread 'set::tests::outer_range_has_rangemap_return_start_greater_than_end_gaps' panicked at 'assertion failed: `(left == right)`
  left: `Some(327828..268254)`,
 right: `None`', src/set.rs:381:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Weird huh?

from rangemap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.