src/base/debug.test.cc
/** Test dumping enabled debug flags with a larger set of flags. */
Test dumping enabled debug flags with a larger set of flags.
Test dumping enabled debug flags with a larger set of flags .
TEST(DebugFlagTest, DumpDebugFlags)
{
    debug::Flag::globalEnable();
    debug::SimpleFlag flag_a("FlagDumpDebugFlagTestA", "");
    debug::SimpleFlag flag_b("FlagDumpDebugFlagTestB", "");
    debug::SimpleFlag flag_c("FlagDumpDebugFlagTestC", "");
    debug::SimpleFlag flag_d("FlagDumpDebugFlagTestD", "");
    debug::SimpleFlag flag_e("FlagDumpDebugFlagTestE", "");
    debug::CompoundFlag compound_flag_a("CompoundFlagDumpDebugFlagTestA", "",
        {&flag_d});
    debug::CompoundFlag compound_flag_b("CompoundFlagDumpDebugFlagTestB", "",
        {&flag_e});
    ASSERT_FALSE(flag_a.tracing());
    ASSERT_FALSE(flag_b.tracing());
    ASSERT_FALSE(flag_c.tracing());
    ASSERT_FALSE(flag_d.tracing());
    ASSERT_FALSE(flag_e.tracing());
    flag_a.enable();
    flag_c.enable();
    compound_flag_b.enable();
    if (TRACING_ON) {
        std::ostringstream os;
        dumpDebugFlags(os);
        std::string output = os.str();
        EXPECT_EQ(output, "FlagDumpDebugFlagTestA\nFlagDumpDebugFlagTestC\n" \
            "FlagDumpDebugFlagTestE\n");
    }
}
TEST ( DebugFlagTest , DumpDebugFlags ) { debug :: Flag :: globalEnable ( ) ; debug :: SimpleFlag flag_a ( " " , " " ) ; debug :: SimpleFlag flag_b ( " " , " " ) ; debug :: SimpleFlag flag_c ( " " , " " ) ; debug :: SimpleFlag flag_d ( " " , " " ) ; debug :: SimpleFlag flag_e ( " " , " " ) ; debug :: CompoundFlag compound_flag_a ( " " , " " , { & flag_d } ) ; debug :: CompoundFlag compound_flag_b ( " " , " " , { & flag_e } ) ; ASSERT_FALSE ( flag_a . tracing ( ) ) ; ASSERT_FALSE ( flag_b . tracing ( ) ) ; ASSERT_FALSE ( flag_c . tracing ( ) ) ; ASSERT_FALSE ( flag_d . tracing ( ) ) ; ASSERT_FALSE ( flag_e . tracing ( ) ) ; flag_a . enable ( ) ; flag_c . enable ( ) ; compound_flag_b . enable ( ) ; if ( TRACING_ON ) { std :: ostringstream os ; dumpDebugFlags ( os ) ; std :: string output = os . str ( ) ; EXPECT_EQ ( output , " \n \n " " \n " ) ; } }
Test dumping enabled debug flags with a larger set of flags.
Test dumping enabled debug flags with a larger set of flags .
// Enable a few flags // Verify that the names of the enabled flags are printed if TRACING_ON.