diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-08-13 14:44:44 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-08-21 07:54:07 +1000 |
commit | 4912b4adb666dad96b832ab2d7caaae49808723e (patch) | |
tree | 433f431acc83cb498d7d9f5ffd1324ef119e6809 /test | |
parent | 7f8c39c8b5ef89153ecd84d16331e96d8feb18ef (diff) |
os: add support for %d and %i to pnprintf
The mouse driver uses %i in some debug messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/signal-logging.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/signal-logging.c b/test/signal-logging.c index 0e352aa0b..3206ddefa 100644 --- a/test/signal-logging.c +++ b/test/signal-logging.c @@ -242,6 +242,27 @@ static void logging_format(void) ui <<= 1; } while(ui); + /* signed number substitution */ + i = 0; + do { + char expected[30]; + sprintf(expected, "(EE) %d\n", i); + LogMessageVerbSigSafe(X_ERROR, -1, "%d\n", i); + read_log_msg(logmsg); + assert(strcmp(logmsg, expected) == 0); + + + sprintf(expected, "(EE) %d\n", i | INT_MIN); + LogMessageVerbSigSafe(X_ERROR, -1, "%d\n", i | INT_MIN); + read_log_msg(logmsg); + assert(strcmp(logmsg, expected) == 0); + + if (i == 0) + i = 1; + else + i <<= 1; + } while(i > INT_MIN); + /* hex number substitution */ ui = 0; do { |