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
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| internal | Loading commit data... | |
| BUILD.bazel | Loading commit data... | |
| CMakeLists.txt | Loading commit data... | |
| benchmarks.cc | Loading commit data... | |
| bernoulli_distribution.h | Loading commit data... | |
| bernoulli_distribution_test.cc | Loading commit data... | |
| beta_distribution.h | Loading commit data... | |
| beta_distribution_test.cc | Loading commit data... | |
| bit_gen_ref.h | Loading commit data... | |
| bit_gen_ref_test.cc | Loading commit data... | |
| discrete_distribution.cc | Loading commit data... | |
| discrete_distribution.h | Loading commit data... | |
| discrete_distribution_test.cc | Loading commit data... | |
| distributions.h | Loading commit data... | |
| distributions_test.cc | Loading commit data... | |
| examples_test.cc | Loading commit data... | |
| exponential_distribution.h | Loading commit data... | |
| exponential_distribution_test.cc | Loading commit data... | |
| gaussian_distribution.cc | Loading commit data... | |
| gaussian_distribution.h | Loading commit data... | |
| gaussian_distribution_test.cc | Loading commit data... | |
| generators_test.cc | Loading commit data... | |
| log_uniform_int_distribution.h | Loading commit data... | |
| log_uniform_int_distribution_test.cc | Loading commit data... | |
| mock_distributions.h | Loading commit data... | |
| mock_distributions_test.cc | Loading commit data... | |
| mocking_bit_gen.h | Loading commit data... | |
| mocking_bit_gen_test.cc | Loading commit data... | |
| poisson_distribution.h | Loading commit data... | |
| poisson_distribution_test.cc | Loading commit data... | |
| random.h | Loading commit data... | |
| seed_gen_exception.cc | Loading commit data... | |
| seed_gen_exception.h | Loading commit data... | |
| seed_sequences.cc | Loading commit data... | |
| seed_sequences.h | Loading commit data... | |
| seed_sequences_test.cc | Loading commit data... | |
| uniform_int_distribution.h | Loading commit data... | |
| uniform_int_distribution_test.cc | Loading commit data... | |
| uniform_real_distribution.h | Loading commit data... | |
| uniform_real_distribution_test.cc | Loading commit data... | |
| zipf_distribution.h | Loading commit data... | |
| zipf_distribution_test.cc | Loading commit data... |