diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-02-28 16:56:28 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-02-28 16:56:28 +0000 |
commit | c8659db28d0eb309502db2ddcf734d119aa2c845 (patch) | |
tree | dc06562f10f32551a68af232ed45933ff3360ab3 /src/or/test.c | |
parent | dae5fc798271db3b993be1b38cfada73e05dab68 (diff) | |
download | tor-c8659db28d0eb309502db2ddcf734d119aa2c845.tar.gz tor-c8659db28d0eb309502db2ddcf734d119aa2c845.zip |
r11982@catbus: nickm | 2007-02-28 11:55:41 -0500
Add unit tests for tor_parse_uint64
svn:r9678
Diffstat (limited to 'src/or/test.c')
-rw-r--r-- | src/or/test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c index a3caec0c01..b9afb99783 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -695,6 +695,18 @@ test_util(void) test_eq(10L, tor_parse_long("10",10,0,100,NULL,NULL)); test_eq(0L, tor_parse_long("10",10,50,100,NULL,NULL)); + /* Test tor_parse_uint64. */ + test_assert(U64_LITERAL(10) == tor_parse_uint64("10 x",10,0,100, &i, &cp)); + test_assert(i == 1); + test_streq(cp, " x"); + test_assert(U64_LITERAL(12345678901) == + tor_parse_uint64("12345678901",10,0,UINT64_MAX, &i, &cp)); + test_assert(i == 1); + test_streq(cp, ""); + test_assert(U64_LITERAL(0) == + tor_parse_uint64("12345678901",10,500,INT32_MAX, &i, &cp)); + test_assert(i == 0); + /* Test parse_line_from_str */ strlcpy(buf, "k v\n" " key value with spaces \n" "keykey val\n" "k2\n" |