src/base/debug.test.cc
/**
 * Tests that manipulate the enablement status of the compound flag to change
 * the corresponding status of the kids.
 */
Tests that manipulate the enablement status of the compound flag to change
the corresponding status of the kids.
Tests that manipulate the enablement status of the compound flag to change the corresponding status of the kids .
TEST(DebugCompoundFlagTest, Enabled)
{
    debug::Flag::globalDisable();
    debug::SimpleFlag flag_a("CompoundFlagEnabledTestKidA", "");
    debug::SimpleFlag flag_b("CompoundFlagEnabledTestKidB", "");
    debug::CompoundFlag flag("CompoundFlagEnabledTest", "",
        {&flag_a, &flag_b});
    ASSERT_FALSE(flag.tracing());
    flag.enable();
    ASSERT_FALSE(flag_a.tracing());
    ASSERT_FALSE(flag_b.tracing());
    ASSERT_FALSE(flag.tracing());
    debug::Flag::globalEnable();
    for (auto &kid : flag.kids()) {
        ASSERT_TRUE(!TRACING_ON || kid->tracing());
    }
    ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
    ASSERT_TRUE(!TRACING_ON || flag_b.tracing());
    flag.disable();
    for (auto &kid : flag.kids()) {
        ASSERT_FALSE(kid->tracing());
    }
    ASSERT_FALSE(flag_a.tracing());
    ASSERT_FALSE(flag_b.tracing());
    ASSERT_FALSE(flag.tracing());
}
TEST ( DebugCompoundFlagTest , Enabled ) { debug :: Flag :: globalDisable ( ) ; debug :: SimpleFlag flag_a ( " " , " " ) ; debug :: SimpleFlag flag_b ( " " , " " ) ; debug :: CompoundFlag flag ( " " , " " , { & flag_a , & flag_b } ) ; ASSERT_FALSE ( flag . tracing ( ) ) ; flag . enable ( ) ; ASSERT_FALSE ( flag_a . tracing ( ) ) ; ASSERT_FALSE ( flag_b . tracing ( ) ) ; ASSERT_FALSE ( flag . tracing ( ) ) ; debug :: Flag :: globalEnable ( ) ; for ( auto & kid : flag . kids ( ) ) { ASSERT_TRUE ( ! TRACING_ON || kid -> tracing ( ) ) ; } ASSERT_TRUE ( ! TRACING_ON || flag_a . tracing ( ) ) ; ASSERT_TRUE ( ! TRACING_ON || flag_b . tracing ( ) ) ; flag . disable ( ) ; for ( auto & kid : flag . kids ( ) ) { ASSERT_FALSE ( kid -> tracing ( ) ) ; } ASSERT_FALSE ( flag_a . tracing ( ) ) ; ASSERT_FALSE ( flag_b . tracing ( ) ) ; ASSERT_FALSE ( flag . tracing ( ) ) ; }
Tests that manipulate the enablement status of the compound flag to change
 the corresponding status of the kids.
Tests that manipulate the enablement status of the compound flag to change the corresponding status of the kids .
// By default flags are initialized disabled // Flags must be globally enabled before individual flags are enabled // Test disabling the flag with global enabled