Permalink
Browse files

Extra tests for string2ll

  • Loading branch information...
1 parent c040cbd commit 3edbcab95a2d5cec861ac28cbdb638ea25d22bb9 @pietern pietern committed Apr 27, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/util.c
View
8 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);

0 comments on commit 3edbcab

Please sign in to comment.