Skip to content

Add unit tests for gov.nasa.jpf.util.FixedBitSet#596

Open
HritikRaj2 wants to merge 1 commit intojavapathfinder:masterfrom
HritikRaj2:add-fixedbitset-tests
Open

Add unit tests for gov.nasa.jpf.util.FixedBitSet#596
HritikRaj2 wants to merge 1 commit intojavapathfinder:masterfrom
HritikRaj2:add-fixedbitset-tests

Conversation

@HritikRaj2
Copy link
Copy Markdown
Contributor

Description

This PR adds a new test class gov.nasa.jpf.test.util.FixedBitSetTest to improve test coverage for the gov.nasa.jpf.util package.

FixedBitSet is a critical interface for memory-efficient bit manipulation in JPF. Since it is an interface, these tests verify its contract using the concrete implementation BitSet64.

Changes

  • Created src/tests/gov/nasa/jpf/test/util/FixedBitSetTest.java

Tests Added

  1. testBasicSetGet: Verifies setting specific bits and ensuring unset bits remain false.
  2. testClear: Ensures bits can be toggled off correctly.
  3. testCardinality: Verifies the count of set bits (population count).
  4. testToString: Checks that the string representation correctly lists set indices.

Verification

  • Ran ./gradlew test
  • Result: Build Successful (tests passed using BitSet64).

Fixes #595

@Mahmoud-Khawaja
Copy link
Copy Markdown
Contributor

Hi Hritik,
Thank you for your pull request. However, it seems that those tests are already exist in src/tests/gov/nasa/jpf/util/BitSet64Test.java. this test class covers set(), get() and clear(). While it’s a good PR, I don’t think it adds much additional value at this point. I think @cyrille-artho an give us some insight on that.

@HritikRaj2
Copy link
Copy Markdown
Contributor Author

Hi Hritik, Thank you for your pull request. However, it seems that those tests are already exist in src/tests/gov/nasa/jpf/util/BitSet64Test.java. this test class covers set(), get() and clear(). While it’s a good PR, I don’t think it adds much additional value at this point. I think @cyrille-artho an give us some insight on that.

Hi @Mahmoud-Khawaja, thank you for pointing this out! You are completely right—I missed the existing BitSet64Test.java file and we definitely shouldn't fragment the test coverage.

Looking at my PR, while the set, get, and clear tests are indeed redundant, I did add new test coverage for cardinality and toString.

@cyrille-artho, would you prefer I port those two specific tests over to the existing BitSet64Test.java and update this PR, or is the current coverage sufficient, and I should just close this PR to keep the repo clean?

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.

Add unit tests for gov.nasa.jpf.util.FixedBitSet

2 participants