Skip to content

Comments

test/unit: add property-based testing#4996

Closed
notxvilka wants to merge 1 commit intodevfrom
property-based-testing
Closed

test/unit: add property-based testing#4996
notxvilka wants to merge 1 commit intodevfrom
property-based-testing

Conversation

@notxvilka
Copy link
Contributor

@notxvilka notxvilka commented Mar 12, 2025

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository.
  • I made sure to follow the project's coding style.
  • I've documented every RZ_API function and struct this PR changes.
  • I've added tests that prove my changes are effective (required for changes to RZ_API).
  • I've updated the Rizin book with the relevant information (if needed).

Detailed description

Added theft-based QuickCheck-style property-based testing for RzNum (as an example).
This is how output looks like:

rizin on  property-based-testing [$!?]                                                                                                                                                                     21:38:04
$ build/test/unit/test_num_quickcheck

== PROP 'rz_num_abs is non-negative': 1000 trials, seed 0x375065ea660251b1
.......................................................................
.............................(PASS x 100).........
== PASS 'rz_num_abs is non-negative': pass 1000, fail 0, skip 0, dup 0

== PROP 'rz_num_abs(-x) == rz_num_abs(x)': 1000 trials, seed 0x375065ea660251b2
.......................................................................
.............................(PASS x 100).........
== PASS 'rz_num_abs(-x) == rz_num_abs(x)': pass 1000, fail 0, skip 0, dup 0

== PROP 'rz_num_bitmask sets correct number of bits': 1000 trials, seed 0x375065ea660251b3
.......................................................................
.............................(PASS x 100).........
== PASS 'rz_num_bitmask sets correct number of bits': pass 1000, fail 0, skip 0, dup 0

== PROP 'rz_num_align_delta produces aligned values': 1000 trials, seed 0x375065ea660251b4
.......................................................................
.............................(PASS x 100).........
== PASS 'rz_num_align_delta produces aligned values': pass 1000, fail 0, skip 0, dup 0

See Theft Usage documentation for more information about the library.

Windows build is blocked on silentbicycle/theft#62

Test plan

CI is green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants