lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guidotag <>
Subject [GitHub] lucenenet pull request: PQ tests
Date Mon, 16 Feb 2015 18:43:23 GMT
GitHub user guidotag opened a pull request:

    PQ tests

    Redesigned PQ's unit tests. Previously they were not testing units but rather the whole
data structure in one single test. The set of tests for each method is the following:
    - public PriorityQueue(int maxSize): TestMaxSizeBounds.
    - public PriorityQueue(int maxSize, bool prepopulate): TestPrepopulation.
    - public T Add(T element): TestAdd, TestDuplicates, TestOverflow.
    - public virtual T InsertWithOverflow(T element): TestInsertWithOverflowDoesNotOverflow,
    - public T Top(): TestAdd.
    - public T Pop(): TestPop.
    - public T UpdateTop(): TestUpdateTop.
    - public int Size(): TestFixedSize, TestPop.
    - public void Clear(): TestClear.
    - private void UpHeap(): Tested via Add's tests.
    - private void DownHeap(): Tested via Pop's tests.
    Also, I included three non-unit tests:
    - Benchmark: A benchmarking routine. Measures execution times for Add and Pop.
    - TestStress: Aims to reproduce a high-loaded real scenario usage.
    - TestPersistence: Tests that there is no loss of data when adding and popping elements.
    Even I did some really small changes on the PQ, its interface remains the same.
    My main goal with these changes is to make future verifications on any changes on the
data structure easy and reliable. Also, I hope this sheds some light on the importance of
having good test classes, which some parts of Lucene.Net are lack of.

You can merge this pull request into a Git repository by running:

    $ git pull ms_pq_fixes

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #97
commit 9c38decabb5dbf4180045b4e4d1477ad5f801341
Author: Guido Tagliavini Ponce <>
Date:   2015-02-11T22:37:41Z

    Added maxSize >= 0 check.

commit 5361c00d9d1a74d0b9c07e0b17a8469a6c966591
Author: Guido Tagliavini Ponce <>
Date:   2015-02-12T22:19:21Z

    Changed a variable name. Changed and added comments.

commit aeb5e0384cf154e97ef16fad522276e501e0818a
Author: Guido Tagliavini Ponce <>
Date:   2015-02-12T22:20:01Z

    Added PQ tests.

commit 84e29b595b638bd5f5ee1022a6207be6676b847b
Author: Guido Tagliavini Ponce <>
Date:   2015-02-12T22:26:31Z

    Removed old tests.

commit 707647d20fc482abcec0713fd47e8f6da39d2c3f
Author: Guido Tagliavini Ponce <>
Date:   2015-02-12T23:01:58Z

    Added one more test.

commit 3c85fc8103b7f53052311a7d49cece32da769a1a
Author: Guido Tagliavini Ponce <>
Date:   2015-02-13T21:45:02Z

    TestStress is now a real stress test. The benchmarks were moved to a special function.
Added persistance test.

commit 04945497e04e239ee54b30c4988baf1026c880bd
Author: Guido Tagliavini Ponce <>
Date:   2015-02-13T21:52:16Z



If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message