NEWS: Fix spelling mistake: "%ob" -> "%Ob".
[glibc.git] / stdlib / tst-fmtmsg.c
blobb7948c5f1eaff603b36076f341367a80f9219140
1 #include <fmtmsg.h>
2 #include <mcheck.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
8 #define MM_TEST 10
10 static int
11 do_test (void)
13 int result = 0;
15 mtrace ();
17 char TEST[] = "ABCD";
18 if (addseverity (MM_TEST, TEST) != MM_OK)
20 puts ("addseverity failed");
21 result = 1;
23 strcpy (TEST, "TEST");
25 if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_HALT, "halt",
26 "should print message for MM_HALT", "GLIBC:tst-fmtmsg:1")
27 != MM_OK)
28 result = 1;
30 if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_ERROR, "halt",
31 "should print message for MM_ERROR", "GLIBC:tst-fmtmsg:2")
32 != MM_OK)
33 result = 1;
35 if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_WARNING, "halt",
36 "should print message for MM_WARNING", "GLIBC:tst-fmtmsg:3")
37 != MM_OK)
38 result = 1;
40 if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_INFO, "halt",
41 "should print message for MM_INFO", "GLIBC:tst-fmtmsg:4")
42 != MM_OK)
43 result = 1;
45 if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_NOSEV, "halt",
46 "should print message for MM_NOSEV", "GLIBC:tst-fmtmsg:5")
47 != MM_OK)
48 result = 1;
50 if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_TEST, "halt",
51 "should print message for MM_TEST", "GLIBC:tst-fmtmsg:6")
52 != MM_OK)
53 result = 1;
55 if (addseverity (MM_TEST, NULL) != MM_OK)
57 puts ("second addseverity failed");
58 result = 1;
61 if (addseverity (MM_TEST, NULL) != MM_NOTOK)
63 puts ("third addseverity unexpectedly succeeded");
64 result = 1;
67 char *p = strdup ("TEST2");
68 if (addseverity (MM_TEST, p) != MM_OK)
70 puts ("fourth addseverity failed");
71 result = 1;
73 if (addseverity (MM_TEST, "TEST3") != MM_OK)
75 puts ("fifth addseverity failed");
76 result = 1;
79 free (p);
81 return result;
84 #define TEST_FUNCTION do_test ()
85 #include "../test-skeleton.c"