Skip to content

More property based testing #658

Description

@dfa1

Top PBT Candidates (unit tests)

HIGH priority:

#: 1
Target: NaturalSortOrder.compare()
Property: Comparator contract: transitivity, antisymmetry, reflexivity
File: spi/src/main/java/hosh/spi/Values.java
────────────────────────────────────────
#: 2
Target: NumericValue/SizeValue.merge()
Property: Commutativity, associativity, identity with none
File: Values.java lines 248, 311
────────────────────────────────────────
#: 3
Target: Sort.run()
Property: Idempotence: sort twice = sort once
File: modules/text/…/TextModule.java
────────────────────────────────────────
#: 4
Target: Take/Drop.run()
Property: Partition: take(n) + drop(n) = original
File: TextModule.java

MEDIUM priority:

│ 5 │ Distinct/Duplicated │ Complement: distinct ∪ duplicated = all records
│ 6 │ Sum/Min/Max │ Order independence (commutativity of fold)
│ 7 │ Enumerate │ Indices are strictly monotonic 1..n
│ 8 │ Records.append() │ Size invariant: record.append(k,v).size() == record.size() + 1


Migration Plan

  1. Add jqwik to parent pom.xml (replace or alongside QuickTheories)
  2. Migrate existing QT tests in ExitStatusTest and ValuesTest to jqwik
  3. Add new @Property tests for candidates above

Existing QT tests in spi are small (2 files) — migration is cheap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions