aboutsummaryrefslogtreecommitdiff
path: root/absl/container/internal/compressed_tuple_test.cc
diff options
context:
space:
mode:
authorJustin Bassett <jbassett@google.com>2024-05-20 10:44:01 -0700
committerCopybara-Service <copybara-worker@google.com>2024-05-20 10:45:19 -0700
commit254b3a5326932026fd23923fd367619d2837f0ad (patch)
treeae7b15f8c6462ed407c89ef5144fdbf5a5a91e2b /absl/container/internal/compressed_tuple_test.cc
parent93ac3a4f9ee7792af399cebd873ee99ce15aed08 (diff)
downloadabseil-254b3a5326932026fd23923fd367619d2837f0ad.tar.gz
abseil-254b3a5326932026fd23923fd367619d2837f0ad.tar.bz2
abseil-254b3a5326932026fd23923fd367619d2837f0ad.zip
Add (unused) validation to absl::MockingBitGen
`absl::Uniform(tag, rng, a, b)` has some restrictions on the values it can produce in that it will always be in the range specified by `a` and `b`, but these restrictions can be violated by `absl::MockingBitGen`. This makes it easier than necessary to introduce a bug in tests using a mock RNG. We can fix this by making `MockingBitGen` emit a runtime error if the value produced is out of bounds. Immediately fixing all the internal buggy uses of `MockingBitGen` is currently infeasible, so the plan is this: 1. Add turned-off validation to `MockingBitGen` to avoid the costs of maintaining unsubmitted code. 2. Temporarily migrate the internal buggy use cases to keep the current behavior, to be fixed later. 3. Turn on validation for `MockingBitGen`. 4. Fix the internal buggy use cases over time. --- A few of the different categories of errors I found: - `Call(tag, rng, a, b) -> a or b`, for open/half-open intervals (i.e. incorrect boundary condition). This case happens quite a lot, e.g. by specifying `absl::Uniform<double>(rng, 0, 1)` to return `1.0`. - `Call(tag, rng, 0, 1) -> 42` (i.e. return an arbitrary value). These may be straightforward to fix by just returning an in-range value, or sometimes they are difficult to fix because other data structures depend on those values. PiperOrigin-RevId: 635503223 Change-Id: I9293ab78e79450e2b7b682dcb05149f238ecc550
Diffstat (limited to 'absl/container/internal/compressed_tuple_test.cc')
0 files changed, 0 insertions, 0 deletions