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

[DMS-78] Add property tests for PersistentOrderedSet #11

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

Sereja313
Copy link
Member

Add property tests for PersistentOrderedSet.

@Sereja313 Sereja313 changed the title mSereja/add set prop tests [DMS-78] Add property tests for PersistentOrderedSet Oct 8, 2024
Comment on lines 75 to 58
func setGen3(samples_number: Nat, size: Nat, range: (Nat, Nat)): Iter.Iter<(Set.Set<Nat>, Set.Set<Nat>, Set.Set<Nat>)> {
object {
var n = 0;
public func next(): ?(Set.Set<Nat>, Set.Set<Nat>, Set.Set<Nat>) {
n += 1;
if (n > samples_number) {
null
} else {
?(natSet.fromIter(Random.nextEntries(range, size).vals()),
natSet.fromIter(Random.nextEntries(range, size).vals()),
natSet.fromIter(Random.nextEntries(range, size).vals()))
}
}
}
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func setGen3(samples_number: Nat, size: Nat, range: (Nat, Nat)): Iter.Iter<(Set.Set<Nat>, Set.Set<Nat>, Set.Set<Nat>)> {
object {
var n = 0;
public func next(): ?(Set.Set<Nat>, Set.Set<Nat>, Set.Set<Nat>) {
n += 1;
if (n > samples_number) {
null
} else {
?(natSet.fromIter(Random.nextEntries(range, size).vals()),
natSet.fromIter(Random.nextEntries(range, size).vals()),
natSet.fromIter(Random.nextEntries(range, size).vals()))
}
}
}
};
func setGenN(samples_number: Nat, size: Nat, range: (Nat, Nat), chunkSize: Nat): Iter.Iter<[Set.Set<Nat>])> {
object {
var n = 0;
public func next(): ?(Set.Set<Nat>, Set.Set<Nat>, Set.Set<Nat>) {
n += 1;
if (n > samples_number) {
null
} else {
?Array.tabulate(chunkSize, func _i = natSet.fromIter(Random.nextEntries(range, size).vals())
}
}
}
};

Copy link

@GoPavel GoPavel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I would ask to add also:

  • diff(a, b) ⊆ a
  • diff(a, b) ∩ b == 0
  • put(put(s, x), x) == put(s, x)

Add property tests for PersistentOrderedSet.
@Sereja313 Sereja313 merged commit 6f4f2d5 into milestone-3 Oct 14, 2024
4 checks passed
@Sereja313 Sereja313 deleted the sereja/add-set-prop-tests branch October 14, 2024 00:57
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 this pull request may close these issues.

2 participants