99a100,116
> * Test abrupt saturation.
> */
> TEST(SatCounterTest, Saturate)
> {
> const unsigned bits = 3;
> const unsigned max_value = (1 << bits) - 1;
> SatCounter counter(bits);
> counter++;
> ASSERT_FALSE(counter.isSaturated());
>
> // Make sure the value added is what was missing to saturate
> const unsigned diff = counter.saturate();
> ASSERT_EQ(diff, max_value - 1);
> ASSERT_TRUE(counter.isSaturated());
> }
>
> /**