Skip to content

Add unit tests for gov.nasa.jpf.util.WeakPool - #594

Open
HritikRaj2 wants to merge 1 commit into
javapathfinder:masterfrom
HritikRaj2:add-weakpool-tests
Open

Add unit tests for gov.nasa.jpf.util.WeakPool#594
HritikRaj2 wants to merge 1 commit into
javapathfinder:masterfrom
HritikRaj2:add-weakpool-tests

Conversation

@HritikRaj2

Copy link
Copy Markdown
Contributor

Description

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

WeakPool is a critical utility for canonicalizing objects using WeakReference, allowing unused objects to be reclaimed by the Garbage Collector.

Changes

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

Tests Added

  1. testBasicPooling: Verifies standard pool operations (add, check existence, deduplication).
  2. testWeakReferenceBehavior: (Key Test) Forces a System.gc() to verify that the pool correctly handles objects being collected when strong references are dropped.
  3. testGrowth: Ensures the pool resizes correctly when capacity is exceeded.

Verification

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

Fixes #593

@HritikRaj2

Copy link
Copy Markdown
Contributor Author

@cyrille-artho
If you get some time, please look at this pr and tell me if any changes are required or not .
and these prs too #592 and #596

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.WeakPool

1 participant