src/base/flags.test.cc
/**
 * Test conditional set. If true the selected bits are set; otherwise, they
 * are cleared.
 */
Test conditional set. If true the selected bits are set; otherwise, they
are cleared.
Test conditional set . If true the selected bits are set ; otherwise they are cleared .
TEST(FlagsTest, ConditionalSet)
{
    const uint32_t value_a = (1 << 5) | (1 << 6);
    const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9);
    Flags<uint32_t> flags_true(value_a);
    flags_true.set(value_b, true);
    ASSERT_EQ(value_a | value_b, uint32_t(flags_true));
    Flags<uint32_t> flags_false(value_a);
    flags_false.set(value_b, false);
    ASSERT_EQ(value_a & ~value_b, uint32_t(flags_false));
}
TEST ( FlagsTest , ConditionalSet ) { const uint32_t value_a = ( 1 << 5 ) | ( 1 << 6 ) ; const uint32_t value_b = ( 1 << 3 ) | ( 1 << 5 ) | ( 1 << 9 ) ; Flags < uint32_t > flags_true ( value_a ) ; flags_true . set ( value_b , true ) ; ASSERT_EQ ( value_a | value_b , uint32_t ( flags_true ) ) ; Flags < uint32_t > flags_false ( value_a ) ; flags_false . set ( value_b , false ) ; ASSERT_EQ ( value_a & ~ value_b , uint32_t ( flags_false ) ) ; }
Test conditional set.
Test conditional set .