]> arthur.barton.de Git - netatalk.git/blobdiff - libevent/test/regress_util.c
Merge remote branch 'origin/product-2-2' into develop
[netatalk.git] / libevent / test / regress_util.c
index f31bb4a24a258ec49634812b2b6d244974f1bae1..88d80577c5c599591fd9355bd24378ab678f2b5f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2010 Nick Mathewson and Niels Provos
+ * Copyright (c) 2009-2012 Nick Mathewson and Niels Provos
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -380,6 +380,11 @@ test_evutil_snprintf(void *ptr)
 {
        char buf[16];
        int r;
+       ev_uint64_t u64 = ((ev_uint64_t)1000000000)*200;
+       ev_int64_t i64 = -1 * (ev_int64_t) u64;
+       size_t size = 8000;
+       ev_ssize_t ssize = -9000;
+
        r = evutil_snprintf(buf, sizeof(buf), "%d %d", 50, 100);
        tt_str_op(buf, ==, "50 100");
        tt_int_op(r, ==, 6);
@@ -388,6 +393,19 @@ test_evutil_snprintf(void *ptr)
        tt_str_op(buf, ==, "longish 1234567");
        tt_int_op(r, ==, 18);
 
+       r = evutil_snprintf(buf, sizeof(buf), EV_U64_FMT, EV_U64_ARG(u64));
+       tt_str_op(buf, ==, "200000000000");
+       tt_int_op(r, ==, 12);
+
+       r = evutil_snprintf(buf, sizeof(buf), EV_I64_FMT, EV_I64_ARG(i64));
+       tt_str_op(buf, ==, "-200000000000");
+       tt_int_op(r, ==, 13);
+
+       r = evutil_snprintf(buf, sizeof(buf), EV_SIZE_FMT" "EV_SSIZE_FMT,
+           EV_SIZE_ARG(size), EV_SSIZE_ARG(ssize));
+       tt_str_op(buf, ==, "8000 -9000");
+       tt_int_op(r, ==, 10);
+
       end:
        ;
 }