aboutsummaryrefslogtreecommitdiff
path: root/absl/synchronization/internal/per_thread_sem_test.cc
diff options
context:
space:
mode:
authorJustin Bassett <jbassett@google.com>2024-06-13 12:43:39 -0700
committerCopybara-Service <copybara-worker@google.com>2024-06-13 12:44:29 -0700
commit33dca3ef75533ba0cc9b099b17409bb354344497 (patch)
tree08151f65827f46ac41a8dcff9423f2516a611c9a /absl/synchronization/internal/per_thread_sem_test.cc
parent7c03b80ef26eef1b34775b035b66a2531d917595 (diff)
downloadabseil-33dca3ef75533ba0cc9b099b17409bb354344497.tar.gz
abseil-33dca3ef75533ba0cc9b099b17409bb354344497.tar.bz2
abseil-33dca3ef75533ba0cc9b099b17409bb354344497.zip
Turn on validation for out of bounds MockUniform in MockingBitGen
This makes MockUniform fail if the action is specified to return an out of bounds value. Examples that will fail: absl::Uniform(gen, 1, 4) -> 42 absl::Uniform(gen, 1, 4) -> 4: [1, 4) absl::Uniform(absl::IntervalOpenClosed, gen, 1, 4) -> 1: (1, 4] Examples that will pass: absl::Uniform(gen, 1, 4) -> 3 absl::Uniform(gen, 1, 4) -> 1: [1, 4) absl::Uniform(absl::IntervalClosed, gen, 1, 4) -> 4: [1, 4] Special case: the empty range always returns its boundary, so this case passes: absl::Uniform(absl::IntervalOpen, 1, 1) -> 1: (1, 1) If this breaks your test, your test has a bug: it's relying on an absl::Uniform() call that returns an impossible value. The UnvalidatedMockingBitGen type temporarily exists to allow for disabling the validation to give a bit of time to fix the test, but this type will go away soon. PiperOrigin-RevId: 643090275 Change-Id: I23470fa9e1efbcb42fa3866237038414545c7be2
Diffstat (limited to 'absl/synchronization/internal/per_thread_sem_test.cc')
0 files changed, 0 insertions, 0 deletions