Giter Site home page Giter Site logo

Kmerge fails about itertools HOT 7 CLOSED

rust-itertools avatar rust-itertools commented on August 29, 2024
Kmerge fails

from itertools.

Comments (7)

tailhook avatar tailhook commented on August 29, 2024

Ah, okay, it's not a crash it actually is wrong result :)

from itertools.

tailhook avatar tailhook commented on August 29, 2024

Here is a test with more clear output:

#[test]
fn kmerge_reverse() {
    let its = vec![3, 2, 1, 0].into_iter().map(|s| (s..10).step(4));
    assert_eq!(
        its.kmerge().collect::<Vec<_>>(),
        (0..10).collect::<Vec<_>>());
}

Output:

   thread 'kmerge_reverse' panicked at 'assertion failed: `(left == right)`
   (left: `[1, 0, 2, 3, 4, 5, 6, 7, 8, 9]`, right: `[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]`)', tests/tests.rs:416

from itertools.

bluss avatar bluss commented on August 29, 2024

Thanks for the bug report!

from itertools.

tailhook avatar tailhook commented on August 29, 2024

This produces a bug in my application. So if you're not looking at it, can you give me some pointers where the error might be?

from itertools.

bluss avatar bluss commented on August 29, 2024

src/kmerge.rs has the heap logic. Prime suspicion would be that the bespoke heap logic is to blame. I'm a bit curious why the quickcheck doesn't catch it though. Probably because it's always testing exactly three input iterators.

from itertools.

tailhook avatar tailhook commented on August 29, 2024

Looks good. Thanks!

from itertools.

bluss avatar bluss commented on August 29, 2024

0.4.17 released with the fix. In hindsight, it's obvious that the existing quickcheck for kmerge didn't exercise it fully (always used a heap of size 3 or smaller).

from itertools.

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.