Macros | Functions
abseil-cpp/absl/flags/flag_test.cc File Reference
#include "absl/flags/flag.h"
#include <stddef.h>
#include <stdint.h>
#include <atomic>
#include <cmath>
#include <new>
#include <string>
#include <thread>
#include <vector>
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/macros.h"
#include "absl/flags/config.h"
#include "absl/flags/declare.h"
#include "absl/flags/internal/flag.h"
#include "absl/flags/marshalling.h"
#include "absl/flags/reflection.h"
#include "absl/flags/usage_config.h"
#include "absl/strings/match.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
Include dependency graph for abseil-cpp/absl/flags/flag_test.cc:

Go to the source code of this file.

Macros

#define DEFINE_CONSTRUCTED_FLAG(T, dflt, dflt_kind)
 
#define FLAG_NAME_MACRO(name)   prefix_ ## name
 
#define TEST_CONSTRUCTED_FLAG(T)   TestConstructionFor(f1##T, f2##T);
 

Functions

 ABSL_DECLARE_FLAG (absl::Duration, test_flag_12)
 
 ABSL_DECLARE_FLAG (bool, test_flag_01)
 
 ABSL_DECLARE_FLAG (double, test_flag_09)
 
 ABSL_DECLARE_FLAG (float, test_flag_10)
 
 ABSL_DECLARE_FLAG (int, FLAG_NAME_MACRO(test_macro_named_flag))
 
 ABSL_DECLARE_FLAG (int, test_flag_02)
 
 ABSL_DECLARE_FLAG (int16_t, test_flag_03)
 
 ABSL_DECLARE_FLAG (int32_t, test_flag_05)
 
 ABSL_DECLARE_FLAG (int64_t, mistyped_int_flag)
 
 ABSL_DECLARE_FLAG (int64_t, test_flag_07)
 
 ABSL_DECLARE_FLAG (std::string, test_flag_11)
 
 ABSL_DECLARE_FLAG (std::vector< std::string >, mistyped_string_flag)
 
 ABSL_DECLARE_FLAG (uint16_t, test_flag_04)
 
 ABSL_DECLARE_FLAG (uint32_t, test_flag_06)
 
 ABSL_DECLARE_FLAG (uint64_t, test_flag_08)
 
 ABSL_FLAG (absl::Duration, test_flag_12, absl::Minutes(10), "test flag 12")
 
 ABSL_FLAG (absl::optional< absl::Duration >, optional_duration, absl::nullopt, "help")
 
 ABSL_FLAG (absl::optional< absl::optional< int >>, optional_optional_int, absl::nullopt, "help")
 
 ABSL_FLAG (absl::optional< bool >, optional_bool, absl::nullopt, "help")
 
 ABSL_FLAG (absl::optional< double >, optional_double, 9.3, "help")
 
 ABSL_FLAG (absl::optional< int >, optional_int, {}, "help")
 
 ABSL_FLAG (absl::optional< std::string >, optional_string, absl::nullopt, "help")
 
 ABSL_FLAG (bool, test_flag_01, true, "test flag 01")
 
 ABSL_FLAG (bool, test_flag_eb_01, {}, "")
 
 ABSL_FLAG (bool, test_flag_with_non_const_help, true, absl::StrCat("test ", "flag ", "non const help"))
 
 ABSL_FLAG (ConversionTestVal, test_flag_implicit_conv, ConversionTestVal::ViaImplicitConv::kTen, "test flag init via implicit conversion")
 
 ABSL_FLAG (CustomUDT, test_flag_custom_udt, CustomUDT(), "test flag custom UDT")
 
 ABSL_FLAG (double, test_flag_09, -9.876e-50, "test flag 09")
 
 ABSL_FLAG (double, test_flag_eb_04, {}, "")
 
 ABSL_FLAG (EnumWrapper, test_enum_wrapper_flag, {}, "help")
 
 ABSL_FLAG (float, test_flag_10, 1.234e12f, "test flag 10")
 
 ABSL_FLAG (int, FLAG_NAME_MACRO(test_macro_named_flag), 0, "Testing macro expansion within ABSL_FLAG")
 
 ABSL_FLAG (int, test_flag_02, 1234, "test flag 02")
 
 ABSL_FLAG (int, test_flag_with_cb, 100, "").OnUpdate(TestFlagCB)
 
 ABSL_FLAG (int, test_flag_with_lambda_cb, 200, "").OnUpdate([]()
 
 ABSL_FLAG (int, test_int_flag_with_non_const_default, GetDflt1(), "test int flag non const default")
 
 ABSL_FLAG (int16_t, test_flag_03, -34, "test flag 03")
 
 ABSL_FLAG (int32_t, test_flag_05, 10765, "test flag 05")
 
 ABSL_FLAG (int32_t, test_flag_eb_02, {}, "")
 
 ABSL_FLAG (int64_t, test_flag_07, -1234567, "test flag 07")
 
 ABSL_FLAG (int64_t, test_flag_eb_03, {}, "")
 
 ABSL_FLAG (NonDfltConstructible, ndc_flag1, NonDfltConstructible('1'), "Flag with non default constructible type")
 
 ABSL_FLAG (NonDfltConstructible, ndc_flag2, 0, "Flag with non default constructible type")
 
 ABSL_FLAG (NonTriviallyCopyableAggregate, test_flag_eb_06, {}, "")
 
 ABSL_FLAG (NonTriviallyCopyableUDT, test_flag_ntc_udt, {}, "help")
 
 ABSL_FLAG (SmallAlignUDT, test_flag_sa_udt, {}, "help")
 
 ABSL_FLAG (std::string, test_flag_11, "", "test flag 11")
 
 ABSL_FLAG (std::string, test_flag_eb_05, {}, "")
 
 ABSL_FLAG (std::string, test_string_flag_with_non_const_default, absl::StrCat("AAA", "BBB"), "test string flag non const default")
 
 ABSL_FLAG (uint16_t, test_flag_04, 189, "test flag 04")
 
 ABSL_FLAG (uint32_t, test_flag_06, 40000, "test flag 06")
 
 ABSL_FLAG (uint64_t, test_flag_08, 9876543, "test flag 08")
 
 ABSL_RETIRED_FLAG (bool, old_bool_flag, true, "old descr")
 
 ABSL_RETIRED_FLAG (int, old_int_flag,(int) std::sqrt(10), "old descr")
 
 ABSL_RETIRED_FLAG (std::string, old_str_flag, "", absl::StrCat("old ", "descr"))
 
 TEST_F (FlagTest, MacroWithinAbslFlag)
 
 TEST_F (FlagTest, TesTypeWrappingEnum)
 

Macro Definition Documentation

◆ DEFINE_CONSTRUCTED_FLAG

#define DEFINE_CONSTRUCTED_FLAG (   T,
  dflt,
  dflt_kind 
)
Value:
constexpr flags::FlagDefaultArg f1default##T{ \
flags::FlagDefaultSrc{dflt}, flags::FlagDefaultKind::dflt_kind}; \
constexpr absl::Flag<T> f1##T{"f1", "file", help_arg, f1default##T}; \
ABSL_CONST_INIT absl::Flag<T> f2##T { \
"f2", "file", \
{flags::FlagHelpMsg(&TestHelpMsg), flags::FlagHelpKind::kGenFunc}, \
flags::FlagDefaultArg { \
flags::FlagDefaultSrc(&TestMakeDflt<T>), \
flags::FlagDefaultKind::kGenFunc \
} \
}

Definition at line 140 of file abseil-cpp/absl/flags/flag_test.cc.

◆ FLAG_NAME_MACRO

#define FLAG_NAME_MACRO (   name)    prefix_ ## name

Definition at line 983 of file abseil-cpp/absl/flags/flag_test.cc.

◆ TEST_CONSTRUCTED_FLAG

#define TEST_CONSTRUCTED_FLAG (   T)    TestConstructionFor(f1##T, f2##T);

Definition at line 191 of file abseil-cpp/absl/flags/flag_test.cc.

Function Documentation

◆ ABSL_DECLARE_FLAG() [1/15]

ABSL_DECLARE_FLAG ( absl::Duration  ,
test_flag_12   
)

◆ ABSL_DECLARE_FLAG() [2/15]

ABSL_DECLARE_FLAG ( bool  ,
test_flag_01   
)

◆ ABSL_DECLARE_FLAG() [3/15]

ABSL_DECLARE_FLAG ( double  ,
test_flag_09   
)

◆ ABSL_DECLARE_FLAG() [4/15]

ABSL_DECLARE_FLAG ( float  ,
test_flag_10   
)

◆ ABSL_DECLARE_FLAG() [5/15]

ABSL_DECLARE_FLAG ( int  ,
FLAG_NAME_MACRO(test_macro_named_flag)   
)

◆ ABSL_DECLARE_FLAG() [6/15]

ABSL_DECLARE_FLAG ( int  ,
test_flag_02   
)

◆ ABSL_DECLARE_FLAG() [7/15]

ABSL_DECLARE_FLAG ( int16_t  ,
test_flag_03   
)

◆ ABSL_DECLARE_FLAG() [8/15]

ABSL_DECLARE_FLAG ( int32_t  ,
test_flag_05   
)

◆ ABSL_DECLARE_FLAG() [9/15]

ABSL_DECLARE_FLAG ( int64_t  ,
mistyped_int_flag   
)

◆ ABSL_DECLARE_FLAG() [10/15]

ABSL_DECLARE_FLAG ( int64_t  ,
test_flag_07   
)

◆ ABSL_DECLARE_FLAG() [11/15]

ABSL_DECLARE_FLAG ( std::string  ,
test_flag_11   
)

◆ ABSL_DECLARE_FLAG() [12/15]

ABSL_DECLARE_FLAG ( std::vector< std::string >  ,
mistyped_string_flag   
)

◆ ABSL_DECLARE_FLAG() [13/15]

ABSL_DECLARE_FLAG ( uint16_t  ,
test_flag_04   
)

◆ ABSL_DECLARE_FLAG() [14/15]

ABSL_DECLARE_FLAG ( uint32_t  ,
test_flag_06   
)

◆ ABSL_DECLARE_FLAG() [15/15]

ABSL_DECLARE_FLAG ( uint64_t  ,
test_flag_08   
)

◆ ABSL_FLAG() [1/37]

ABSL_FLAG ( absl::Duration  ,
test_flag_12  ,
absl::Minutes(10)  ,
"test flag 12"   
)

◆ ABSL_FLAG() [2/37]

ABSL_FLAG ( absl::optional< absl::Duration ,
optional_duration  ,
absl::nullopt  ,
"help"   
)

◆ ABSL_FLAG() [3/37]

ABSL_FLAG ( absl::optional< absl::optional< int >>  ,
optional_optional_int  ,
absl::nullopt  ,
"help"   
)

◆ ABSL_FLAG() [4/37]

ABSL_FLAG ( absl::optional< bool ,
optional_bool  ,
absl::nullopt  ,
"help"   
)

◆ ABSL_FLAG() [5/37]

ABSL_FLAG ( absl::optional< double >  ,
optional_double  ,
9.  3,
"help"   
)

◆ ABSL_FLAG() [6/37]

ABSL_FLAG ( absl::optional< int ,
optional_int  ,
{}  ,
"help"   
)

◆ ABSL_FLAG() [7/37]

ABSL_FLAG ( absl::optional< std::string >  ,
optional_string  ,
absl::nullopt  ,
"help"   
)

◆ ABSL_FLAG() [8/37]

ABSL_FLAG ( bool  ,
test_flag_01  ,
true  ,
"test flag 01"   
)

◆ ABSL_FLAG() [9/37]

ABSL_FLAG ( bool  ,
test_flag_eb_01  ,
{}  ,
""   
)

◆ ABSL_FLAG() [10/37]

ABSL_FLAG ( bool  ,
test_flag_with_non_const_help  ,
true  ,
absl::StrCat("test ", "flag ", "non const help")   
)

◆ ABSL_FLAG() [11/37]

ABSL_FLAG ( ConversionTestVal  ,
test_flag_implicit_conv  ,
ConversionTestVal::ViaImplicitConv::kTen  ,
"test flag init via implicit conversion"   
)

◆ ABSL_FLAG() [12/37]

ABSL_FLAG ( CustomUDT  ,
test_flag_custom_udt  ,
CustomUDT()  ,
"test flag custom UDT  
)

◆ ABSL_FLAG() [13/37]

ABSL_FLAG ( double  ,
test_flag_09  ,
-9.876e-  50,
"test flag 09"   
)

◆ ABSL_FLAG() [14/37]

ABSL_FLAG ( double  ,
test_flag_eb_04  ,
{}  ,
""   
)

◆ ABSL_FLAG() [15/37]

ABSL_FLAG ( EnumWrapper  ,
test_enum_wrapper_flag  ,
{}  ,
"help"   
)

◆ ABSL_FLAG() [16/37]

ABSL_FLAG ( float  ,
test_flag_10  ,
1.  234e12f,
"test flag 10"   
)

◆ ABSL_FLAG() [17/37]

ABSL_FLAG ( int  ,
FLAG_NAME_MACRO(test_macro_named_flag)  ,
,
"Testing macro expansion within ABSL_FLAG"   
)

◆ ABSL_FLAG() [18/37]

ABSL_FLAG ( int  ,
test_flag_02  ,
1234  ,
"test flag 02"   
)

◆ ABSL_FLAG() [19/37]

ABSL_FLAG ( int  ,
test_flag_with_cb  ,
100  ,
""   
)

◆ ABSL_FLAG() [20/37]

ABSL_FLAG ( int  ,
test_flag_with_lambda_cb  ,
200  ,
""   
)

Definition at line 669 of file abseil-cpp/absl/flags/flag_test.cc.

◆ ABSL_FLAG() [21/37]

ABSL_FLAG ( int  ,
test_int_flag_with_non_const_default  ,
GetDflt1()  ,
"test int flag non const default"   
)

◆ ABSL_FLAG() [22/37]

ABSL_FLAG ( int16_t  ,
test_flag_03  ,
34,
"test flag 03"   
)

◆ ABSL_FLAG() [23/37]

ABSL_FLAG ( int32_t  ,
test_flag_05  ,
10765  ,
"test flag 05"   
)

◆ ABSL_FLAG() [24/37]

ABSL_FLAG ( int32_t  ,
test_flag_eb_02  ,
{}  ,
""   
)

◆ ABSL_FLAG() [25/37]

ABSL_FLAG ( int64_t  ,
test_flag_07  ,
1234567,
"test flag 07"   
)

◆ ABSL_FLAG() [26/37]

ABSL_FLAG ( int64_t  ,
test_flag_eb_03  ,
{}  ,
""   
)

◆ ABSL_FLAG() [27/37]

ABSL_FLAG ( NonDfltConstructible  ,
ndc_flag1  ,
NonDfltConstructible( '1')  ,
"Flag with non default constructible type  
)

◆ ABSL_FLAG() [28/37]

ABSL_FLAG ( NonDfltConstructible  ,
ndc_flag2  ,
,
"Flag with non default constructible type  
)

◆ ABSL_FLAG() [29/37]

ABSL_FLAG ( NonTriviallyCopyableAggregate  ,
test_flag_eb_06  ,
{}  ,
""   
)

◆ ABSL_FLAG() [30/37]

ABSL_FLAG ( NonTriviallyCopyableUDT  ,
test_flag_ntc_udt  ,
{}  ,
"help"   
)

◆ ABSL_FLAG() [31/37]

ABSL_FLAG ( SmallAlignUDT  ,
test_flag_sa_udt  ,
{}  ,
"help"   
)

◆ ABSL_FLAG() [32/37]

ABSL_FLAG ( std::string  ,
test_flag_11  ,
""  ,
"test flag 11"   
)

◆ ABSL_FLAG() [33/37]

ABSL_FLAG ( std::string  ,
test_flag_eb_05  ,
{}  ,
""   
)

◆ ABSL_FLAG() [34/37]

ABSL_FLAG ( std::string  ,
test_string_flag_with_non_const_default  ,
absl::StrCat("AAA", "BBB")  ,
"test string flag non const default"   
)

◆ ABSL_FLAG() [35/37]

ABSL_FLAG ( uint16_t  ,
test_flag_04  ,
189  ,
"test flag 04"   
)

◆ ABSL_FLAG() [36/37]

ABSL_FLAG ( uint32_t  ,
test_flag_06  ,
40000  ,
"test flag 06"   
)

◆ ABSL_FLAG() [37/37]

ABSL_FLAG ( uint64_t  ,
test_flag_08  ,
9876543  ,
"test flag 08"   
)

◆ ABSL_RETIRED_FLAG() [1/3]

ABSL_RETIRED_FLAG ( bool  ,
old_bool_flag  ,
true  ,
"old descr"   
)

◆ ABSL_RETIRED_FLAG() [2/3]

ABSL_RETIRED_FLAG ( int  ,
old_int_flag  ,
(int) std::sqrt(10)  ,
"old descr"   
)

◆ ABSL_RETIRED_FLAG() [3/3]

ABSL_RETIRED_FLAG ( std::string  ,
old_str_flag  ,
""  ,
absl::StrCat("old ", "descr")   
)

◆ TEST_F() [1/2]

TEST_F ( FlagTest  ,
MacroWithinAbslFlag   
)

Definition at line 988 of file abseil-cpp/absl/flags/flag_test.cc.

◆ TEST_F() [2/2]

TEST_F ( FlagTest  ,
TesTypeWrappingEnum   
)

Definition at line 971 of file abseil-cpp/absl/flags/flag_test.cc.

xds_manager.f1
f1
Definition: xds_manager.py:42
T
#define T(upbtypeconst, upbtype, ctype, default_value)
absl::flags_internal::FlagHelpMsg
Definition: abseil-cpp/absl/flags/internal/flag.h:203
absl::flags_internal::Flag
Definition: abseil-cpp/absl/flags/declare.h:36
absl::flags_internal::FlagDefaultArg
Definition: abseil-cpp/absl/flags/internal/flag.h:271
xds_manager.f2
f2
Definition: xds_manager.py:85


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:13