You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 32c1aff
Browse filesBrowse the repository at this point in the historyBrowse files
Tests: Make the integer properties cover every type on every run
Review of the first version of the suite found four holes.
- The conversion sites returned the converted value, which shows its
bits but not the type it was stored as. The untyped_local site passed
over a real bug that way. Each site now reads the value back through
an expression whose result depends on its sign and width.
- With the type drawn at random, 25 examples per site left a single type
with about 3. A deliberately broken c_bool conversion went undetected
under some seeds. The conversion property is now parametrized by
destination type and the operator property by left operand type, a
sixteenth of the profile's examples each.
- The global_init site was a strict xfail. Hypothesis shrank its
expected failures, which took 115 of the property's 187 seconds. Its
two bugs are now pinned in test_known_gaps.py, and the site steps
around them.
- Gaps are now stepped around by drawing only inputs that avoid them,
not by assume(). Filtering tripped Hypothesis's filter_too_much health
check.
untyped-copy-keeps-narrow-type is renamed untyped-copy-keeps-source-type.
`t = a` keeps a's type for any source that is not 64-bit, c_uint32 and
c_int32 included, not only narrow ones.
Under the ci profile, each of these deliberate compiler bugs fails a
property:
- >> always logical
- % always unsigned
- / always unsigned
- equal-width mixed signs going signed
- promotion keeping an unsigned sign
- widening always by zero-extension
- c_bool conversion by truncation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: tests/README.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,8 +154,8 @@ programs are generated, and each one is compiled two ways and run.
154
154
| File | Property |
155
155
|---|---|
156
156
|`test_int_expressions.py`| Random straight-line programs over every ctypes integer type and `c_bool`: `+ - * / // % << >> & \| ^`, comparisons as values, unary `-`, `not`, constructor casts, typed and untyped temporaries, nested. The worked examples of `integers.md` are pinned with `@example`. |
157
-
|`test_int_operators.py`| Every binary operator on every pair of operand types, values drawn edge-first. Random trees rarely reach a negative dividend under a signed `%` and return it undisturbed; this property always does. |
158
-
|`test_int_conversions.py`| Every (source type, destination type, site) triple, where a site is each place a conversion happens: constructor call, declaration, reassignment, untyped local, global store, `return`, global initialiser, and each augmented assignment. |
157
+
|`test_int_operators.py`| Every binary operator, parametrized by the left operand's type, with the right type and both values drawn (edge values first). Random trees rarely reach a negative dividend under a signed `%` and return it undisturbed; this property always does. |
158
+
|`test_int_conversions.py`| Every conversion site, parametrized by the destination type: constructor call, declaration, reassignment, untyped local, global store, `return`, global initialiser, and each augmented assignment. The converted value is read back through an expression whose result depends on its sign and width, not just returned, so a value stored with the right bits but the wrong type is caught too. |
159
159
|`test_known_gaps.py`| Each known divergence's smallest program, as a strict xfail. |
160
160
161
161
### Known gaps
@@ -164,8 +164,10 @@ programs are generated, and each one is compiled two ways and run.
164
164
had fixed. Each has a predicate, so the properties step around it and keep
165
165
finding *new* bugs, and a pinned program that `test_known_gaps.py` runs as a
166
166
strict xfail. A fix makes that test XPASS, failing the run until the gap is
167
-
deleted, at which point the properties cover that ground again. A failing
168
-
conversion site is a strict xfail on its parameter instead.
167
+
deleted, at which point the properties cover that ground again. The
168
+
operator and conversion properties step around a gap by drawing only what
169
+
avoids it (not by filtering, which Hypothesis rightly complains about), with
0 commit comments