mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
Add a C++ test for common macros
Make sure that there is no problem with using these macros in C++ context, since typeof is defined differently there.
This commit is contained in:
@@ -580,6 +580,15 @@ test_clear_com (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_common_macros (void)
|
||||
{
|
||||
g_assert_true (MAX (1, 2) == 2);
|
||||
g_assert_true (MIN (1.5, 2) == 1.5);
|
||||
g_assert_true (CLAMP (1, 2, 3) == 2);
|
||||
g_assert_true (ABS (-3.5) == 3.5);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -613,6 +622,7 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/C++/str-has-suffix/macro", test_str_has_suffix_macro);
|
||||
g_test_add_func ("/C++/string-append", test_string_append);
|
||||
g_test_add_func ("/C++/string-free", test_string_free);
|
||||
g_test_add_func ("/C++/common-macros", test_common_macros);
|
||||
|
||||
#if G_CXX_STD_CHECK_VERSION(14)
|
||||
g_test_add_func ("/C++/constexpr-var-init", test_constexpr_var_init);
|
||||
|
Reference in New Issue
Block a user