PR21978, objdump does not display line numbers in certain cases
[deliverable/binutils-gdb.git] / gdb / unittests / common-utils-selftests.c
CommitLineData
d4081a38
PA
1/* Self tests for general utility routines for GDB, the GNU debugger.
2
61baf725 3 Copyright (C) 2016-2017 Free Software Foundation, Inc.
d4081a38
PA
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
b2f8eb7a 20#include "common-defs.h"
d4081a38
PA
21#include "selftest.h"
22
d4081a38
PA
23namespace selftests {
24
d4081a38 25static void
b2f8eb7a 26string_printf_tests ()
d4081a38
PA
27{
28 SELF_CHECK (string_printf ("%s", "") == "");
29 SELF_CHECK (string_printf ("%d comes before 2", 1) == "1 comes before 2");
30 SELF_CHECK (string_printf ("hello %s", "world") == "hello world");
31
32#define X10 "0123456789"
33#define X100 X10 X10 X10 X10 X10 X10 X10 X10 X10 X10
34#define X1000 X100 X100 X100 X100 X100 X100 X100 X100 X100 X100
35#define X10000 X1000 X1000 X1000 X1000 X1000 X1000 X1000 X1000 X1000 X1000
36#define X100000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000
37 SELF_CHECK (string_printf ("%s", X10) == X10);
38 SELF_CHECK (string_printf ("%s", X100) == X100);
39 SELF_CHECK (string_printf ("%s", X1000) == X1000);
40 SELF_CHECK (string_printf ("%s", X10000) == X10000);
41 SELF_CHECK (string_printf ("%s", X100000) == X100000);
42}
43
44} /* namespace selftests */
45
d4081a38 46void
b2f8eb7a 47_initialize_common_utils_selftests ()
d4081a38 48{
b2f8eb7a 49 selftests::register_test ("string_printf", selftests::string_printf_tests);
d4081a38 50}
This page took 0.121947 seconds and 4 git commands to generate.