aboutsummaryrefslogtreecommitdiff
path: root/gdb/unittests/format_pieces-selftests.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2023-02-08 15:36:23 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2023-02-08 15:46:02 -0500
commitc583a2520616c2736cffc389c89a48b159366e6c (patch)
treeb4925f26506fcee96c16119431c01760f05db95d /gdb/unittests/format_pieces-selftests.c
parentca7f92c2f15b86b09c4a8ad14806bef666308d31 (diff)
downloadgdb-users/simark/clang-format.zip
gdb-users/simark/clang-format.tar.gz
gdb-users/simark/clang-format.tar.bz2
Run clang-format.shusers/simark/clang-format
Change-Id: Ia948cc26d534b0dd02702244d52434b1a2093968
Diffstat (limited to 'gdb/unittests/format_pieces-selftests.c')
-rw-r--r--gdb/unittests/format_pieces-selftests.c99
1 files changed, 45 insertions, 54 deletions
diff --git a/gdb/unittests/format_pieces-selftests.c b/gdb/unittests/format_pieces-selftests.c
index dd10b0b..46446e0 100644
--- a/gdb/unittests/format_pieces-selftests.c
+++ b/gdb/unittests/format_pieces-selftests.c
@@ -27,8 +27,10 @@
#define LL "ll"
#endif
-namespace selftests {
-namespace format_pieces {
+namespace selftests
+{
+namespace format_pieces
+{
/* Verify that parsing STR gives pieces equal to EXPECTED_PIECES. */
@@ -47,9 +49,9 @@ static void
test_escape_sequences ()
{
check ("This is an escape sequence: \\e",
- {
- format_piece ("This is an escape sequence: \e", literal_piece, 0),
- });
+ {
+ format_piece ("This is an escape sequence: \e", literal_piece, 0),
+ });
}
static void
@@ -58,28 +60,29 @@ test_format_specifier ()
/* The format string here ends with a % sequence, to ensure we don't
see a trailing empty literal piece. */
check ("Hello\\t %d%llx%%d%d", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%d", int_arg, 0),
- format_piece ("%" LL "x", long_long_arg, 0),
- format_piece ("%%d", literal_piece, 0),
- format_piece ("%d", int_arg, 0),
- });
+ {
+ format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%d", int_arg, 0),
+ format_piece ("%" LL "x", long_long_arg, 0),
+ format_piece ("%%d", literal_piece, 0),
+ format_piece ("%d", int_arg, 0),
+ });
}
static void
test_gdb_formats ()
{
check ("Hello\\t \"%p[%pF%ps%*.*d%p]\"",
- {
- format_piece ("Hello\\t \"", literal_piece, 0),
- format_piece ("%p[", ptr_arg, 0),
- format_piece ("%pF", ptr_arg, 0),
- format_piece ("%ps", ptr_arg, 0),
- format_piece ("%*.*d", int_arg, 2),
- format_piece ("%p]", ptr_arg, 0),
- format_piece ("\"", literal_piece, 0),
- }, true);
+ {
+ format_piece ("Hello\\t \"", literal_piece, 0),
+ format_piece ("%p[", ptr_arg, 0),
+ format_piece ("%pF", ptr_arg, 0),
+ format_piece ("%ps", ptr_arg, 0),
+ format_piece ("%*.*d", int_arg, 2),
+ format_piece ("%p]", ptr_arg, 0),
+ format_piece ("\"", literal_piece, 0),
+ },
+ true);
}
/* Test the different size modifiers that can be applied to an integer
@@ -89,50 +92,37 @@ static void
test_format_int_sizes ()
{
check ("Hello\\t %hu%lu%llu%zu", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hu", int_arg, 0),
- format_piece ("%lu", long_arg, 0),
- format_piece ("%" LL "u", long_long_arg, 0),
- format_piece ("%zu", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%hu", int_arg, 0), format_piece ("%lu", long_arg, 0),
+ format_piece ("%" LL "u", long_long_arg, 0),
+ format_piece ("%zu", size_t_arg, 0) });
check ("Hello\\t %hx%lx%llx%zx", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hx", int_arg, 0),
- format_piece ("%lx", long_arg, 0),
- format_piece ("%" LL "x", long_long_arg, 0),
- format_piece ("%zx", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%hx", int_arg, 0), format_piece ("%lx", long_arg, 0),
+ format_piece ("%" LL "x", long_long_arg, 0),
+ format_piece ("%zx", size_t_arg, 0) });
check ("Hello\\t %ho%lo%llo%zo", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%ho", int_arg, 0),
- format_piece ("%lo", long_arg, 0),
- format_piece ("%" LL "o", long_long_arg, 0),
- format_piece ("%zo", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%ho", int_arg, 0), format_piece ("%lo", long_arg, 0),
+ format_piece ("%" LL "o", long_long_arg, 0),
+ format_piece ("%zo", size_t_arg, 0) });
check ("Hello\\t %hd%ld%lld%zd", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hd", int_arg, 0),
- format_piece ("%ld", long_arg, 0),
- format_piece ("%" LL "d", long_long_arg, 0),
- format_piece ("%zd", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%hd", int_arg, 0), format_piece ("%ld", long_arg, 0),
+ format_piece ("%" LL "d", long_long_arg, 0),
+ format_piece ("%zd", size_t_arg, 0) });
}
static void
test_windows_formats ()
{
- check ("rc%I64d",
- {
- format_piece ("rc", literal_piece, 0),
- format_piece ("%I64d", long_long_arg, 0),
- });
+ check ("rc%I64d", {
+ format_piece ("rc", literal_piece, 0),
+ format_piece ("%I64d", long_long_arg, 0),
+ });
}
static void
@@ -149,6 +139,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_format_pieces_selftests ();
+
void
_initialize_format_pieces_selftests ()
{