diff options
author | Evan Green <evgreen@chromium.org> | 2019-09-26 13:36:07 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-05 00:47:55 +0000 |
commit | 3247d52abeb0ccacc49f0d18dadf47c77f8f0177 (patch) | |
tree | 1d89876b26c86559648f3933c9d7b5f335acb1f4 /test/printf.c | |
parent | 44c473cdeae53aba84fc2ababeaeb7d022ea4dd7 (diff) | |
download | chrome-ec-3247d52abeb0ccacc49f0d18dadf47c77f8f0177.tar.gz |
test: Add printf test for %pT
Add a couple basic tests for %pT values.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=none
Change-Id: I8cb56017b883b6257e1432bd64eae3ae943edf8b
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1828067
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'test/printf.c')
-rw-r--r-- | test/printf.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/printf.c b/test/printf.c index 28a78ca973..400f9a4064 100644 --- a/test/printf.c +++ b/test/printf.c @@ -257,6 +257,18 @@ test_static int test_vsnprintf_strings(void) return EC_SUCCESS; } +test_static int test_vsnprintf_timestamps(void) +{ + uint64_t ts = 0; + + T(expect_success("0.000000", "%pT", &ts)); + ts = 123456; + T(expect_success("0.123456", "%pT", &ts)); + ts = 9999999000000; + T(expect_success("9999999.000000", "%pT", &ts)); + return EC_SUCCESS; +} + test_static int test_vsnprintf_hexdump(void) { const char bytes[] = {0x00, 0x5E}; @@ -283,6 +295,7 @@ void run_test(void) RUN_TEST(test_vsnprintf_pointers); RUN_TEST(test_vsnprintf_chars); RUN_TEST(test_vsnprintf_strings); + RUN_TEST(test_vsnprintf_timestamps); RUN_TEST(test_vsnprintf_hexdump); RUN_TEST(test_vsnprintf_combined); |