summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2011-04-27 14:38:58 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2011-05-05 16:32:22 +0200
commit3edbcab95a2d5cec861ac28cbdb638ea25d22bb9 (patch)
treed6e3ed988c63dcd9dd4ce03e99fdee0f63f3436b /src/util.c
parentc040cbd6252b493456ca910d7b1d1cf4122959d4 (diff)
downloadredis-3edbcab95a2d5cec861ac28cbdb638ea25d22bb9.tar.gz
Extra tests for string2ll
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 5712241b1..e83dbeddc 100644
--- a/src/util.c
+++ b/src/util.c
@@ -336,6 +336,14 @@ void test_string2ll(void) {
strcpy(buf,"+1");
assert(string2ll(buf,strlen(buf),&v) == 0);
+ /* Leading space. */
+ strcpy(buf," 1");
+ assert(string2ll(buf,strlen(buf),&v) == 0);
+
+ /* Trailing space. */
+ strcpy(buf,"1 ");
+ assert(string2ll(buf,strlen(buf),&v) == 0);
+
/* May not start with 0. */
strcpy(buf,"01");
assert(string2ll(buf,strlen(buf),&v) == 0);