Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple failing test #6

Open
Alex-Fischman opened this issue Jun 20, 2023 · 5 comments · May be fixed by #7
Open

Simple failing test #6

Alex-Fischman opened this issue Jun 20, 2023 · 5 comments · May be fixed by #7

Comments

@Alex-Fischman
Copy link

The following test fails:

#[test]
fn subsets_small2() {
  let mut v = SetTrie::new();
  v.insert(&[1, 2], 'a');
  
  let mut s = v.subsets(&[&0, &2]);
  let o = s.next();
  assert_eq!(o, None);
}

The test is correct because we construct a set-trie that only contains the set {1, 2}. We then query for all subsets of {0, 2}. However, since {1, 2} is not a subset of {0, 2}, we should get the empty iterator.

@KaiserKarel
Copy link
Owner

I'll check this out tomorrow. I use an in-tree fork internally, which has a bugfix for this I reckon.

@KaiserKarel KaiserKarel linked a pull request Jun 21, 2023 that will close this issue
@KaiserKarel
Copy link
Owner

@Alex-Fischman could you review and test 6-simple-failing-test and see if it resolves your issue?

@wilcoxjay
Copy link

wilcoxjay commented Jun 21, 2023

There seems to be a similar problem with supersets:

    #[test]
    fn superset_small2() {
        let mut v = SetTrie::new();
        v.insert(&[0, 2], ());
        assert_eq!(v.supersets(&[&0, &1]).next(), None);
    }

Similar to the original test for subsets, the correct answer here is the empty iterator because {0,2} is not a superset of {0,1}.

@wilcoxjay
Copy link

wilcoxjay commented Jun 21, 2023

And here's another small test for subsets that still fails on branch 6-simple-failing-test (though it passes on the main branch).

    #[test]
    fn subsets_small3() {
        let mut v = SetTrie::new();
        v.insert([], ());
        assert_eq!(v.subsets(&[0]).next(), Some(&()));
    }

Since the empty set is a subset of {0}, the iterator should not be empty.

@KaiserKarel
Copy link
Owner

I've identified the issue, booked out this weekend to resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants