Skip to content

test: add property-based tests for AND/OR/NOT composition laws - #21

Merged
rasuvaeff merged 1 commit into
masterfrom
feat/property-composition-laws
Aug 5, 2026
Merged

test: add property-based tests for AND/OR/NOT composition laws#21
rasuvaeff merged 1 commit into
masterfrom
feat/property-composition-laws

Conversation

@rasuvaeff

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/Integration/CompositionLawsPropertyTest.php: 8 property-based
    tests (rasuvaeff/property-testing) covering the composition algebra —
    andIsCommutative, andIsAssociative, orIsCommutative,
    orIsAssociative, andIsIdempotent, deMorganAnd, deMorganOr,
    distributive.
  • Laws are compared semantically: two specification trees are applied via
    QueryApplier to a fresh in-memory SQLite query against a fixed seeded
    items table, and the resulting row-id sets are compared. The package has
    no toSql()/getParameters() — this is the only way to compare trees for
    equivalence.
  • Operands are drawn from a pool of 10 ComparisonSpecification leaves
    covering every column/operator shape in the table, optionally wrapped in
    NotSpecification (Gen::recursive, equal odds) to also exercise the
    negated-operand subquery path.

Fixes #20 (part of the monorepo-wide TESTING-STRENGTHENING-PLAN.md §1.1).

Verification

  • Sanity check: temporarily made QueryBuildingVisitor::visitNot() a no-op —
    deMorganAnd, deMorganOr and distributive all failed with shrunk
    counterexamples; reverted before committing.
  • composer build green (validate → normalize → require-checker → cs →
    psalm → 258 tests, 2518 assertions, including the new 8 properties in the
    Integration suite).

Test plan

  • composer build passes
  • New properties falsify when NOT handling is broken

@rasuvaeff
rasuvaeff merged commit 93f3733 into master Aug 5, 2026
9 checks passed
@rasuvaeff
rasuvaeff deleted the feat/property-composition-laws branch August 5, 2026 16:07
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 property-based tests for AND/OR/NOT composition laws

1 participant