]> git.saurik.com Git - redis.git/commitdiff
Extra tests for string2ll
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Wed, 27 Apr 2011 12:38:58 +0000 (14:38 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Thu, 5 May 2011 14:32:22 +0000 (16:32 +0200)
src/util.c

index 5712241b15df9748c9114512b335e4e7611a35ba..e83dbeddc0e856b4e6a2bfeef72c17e7965b6b6e 100644 (file)
@@ -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);