src/base/debug.test.cc
/** Test enabling and disabling simple flags, as well as the global enabler. */
Test enabling and disabling simple flags, as well as the global enabler.
Test enabling and disabling simple flags as well as the global enabler .
TEST(DebugSimpleFlagTest, Enabled)
{
    debug::Flag::globalDisable();
    debug::SimpleFlag flag("SimpleFlagEnabledTest", "");
    ASSERT_FALSE(flag.tracing());
    flag.enable();
    ASSERT_FALSE(flag.tracing());
    debug::Flag::globalEnable();
    ASSERT_TRUE(!TRACING_ON || flag.tracing());
    debug::Flag::globalDisable();
    ASSERT_FALSE(flag.tracing());
    debug::Flag::globalEnable();
    ASSERT_TRUE(!TRACING_ON || flag.tracing());
    flag.disable();
    ASSERT_FALSE(flag.tracing());
}
TEST ( DebugSimpleFlagTest , Enabled ) { debug :: Flag :: globalDisable ( ) ; debug :: SimpleFlag flag ( " " , " " ) ; ASSERT_FALSE ( flag . tracing ( ) ) ; flag . enable ( ) ; ASSERT_FALSE ( flag . tracing ( ) ) ; debug :: Flag :: globalEnable ( ) ; ASSERT_TRUE ( ! TRACING_ON || flag . tracing ( ) ) ; debug :: Flag :: globalDisable ( ) ; ASSERT_FALSE ( flag . tracing ( ) ) ; debug :: Flag :: globalEnable ( ) ; ASSERT_TRUE ( ! TRACING_ON || flag . tracing ( ) ) ; flag . disable ( ) ; ASSERT_FALSE ( flag . tracing ( ) ) ; }
Test enabling and disabling simple flags, as well as the global enabler.
Test enabling and disabling simple flags as well as the global enabler .
// By default flags are initialized disabled // Flags must be globally enabled before individual flags are enabled // Verify that the global enabler works // Test disabling the flag with global enabled