Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Change for comment.
  • Loading branch information
viirya committed Sep 27, 2018
commit 22bfa8036ad43534db2e2d4736a8b3ccc44b92b1
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ class OpenHashSetSuite extends SparkFunSuite with Matchers {
set.add(i)
assert(set.contains(i))

val pos1 = set.addWithoutResize(i) & OpenHashSet.POSITION_MASK
val pos2 = set.getPos(i)
val pos1 = set.getPos(i)
val pos2 = set.addWithoutResize(i) & OpenHashSet.POSITION_MASK
assert(pos1 == pos2)
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: Is it better to add the following to check each value after adding all, too?

for (i <- 0 until cnt) {
  assert(set.contains(i))
}

Copy link
Member Author

Choose a reason for hiding this comment

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

If we want to add the check, we can also add it inside the loop. Another loop seems unnecessary to me.

Copy link
Member

Choose a reason for hiding this comment

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

My intention was to verify whether small values (e.g. 0, 1, 2, 3) are still valid after several resizings.

Copy link
Member Author

@viirya viirya Sep 28, 2018

Choose a reason for hiding this comment

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

I see. I think that is not what this wants test and there are other tests to make sure it works. If you insist I can add it too.

Copy link
Member

Choose a reason for hiding this comment

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

The original test performed a check by using map.iterator.count(). But, this is not a strong preference.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, the original test performed the count check to see how many values are invalid. They are invalid values because the index is wrong due to wrong position mask in OpenHashSet.

This rewritten test tests directly the index of OpenHashSet.

}
Expand Down