summaryrefslogtreecommitdiff
path: root/pjlib/src/pjlib-test/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib/src/pjlib-test/string.c')
-rw-r--r--pjlib/src/pjlib-test/string.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/pjlib/src/pjlib-test/string.c b/pjlib/src/pjlib-test/string.c
index c8bee0bc..dd3649cc 100644
--- a/pjlib/src/pjlib-test/string.c
+++ b/pjlib/src/pjlib-test/string.c
@@ -48,6 +48,7 @@
* - pj_strtrim()
* - pj_utoa()
* - pj_strtoul()
+ * - pj_strtoul2()
* - pj_create_random_string()
* - ... and mode..
*
@@ -358,6 +359,32 @@ int string_test(void)
if (pj_strtoul(&s5) != UL_VALUE)
return -280;
+ /*
+ * pj_strtoul2()
+ */
+ s5 = pj_str("123456");
+
+ pj_strtoul2(&s5, NULL, 10); /* Crash test */
+
+ if (pj_strtoul2(&s5, &s4, 10) != 123456UL)
+ return -290;
+ if (s4.slen != 0)
+ return -291;
+ if (pj_strtoul2(&s5, &s4, 16) != 0x123456UL)
+ return -292;
+
+ s5 = pj_str("0123ABCD");
+ if (pj_strtoul2(&s5, &s4, 10) != 123)
+ return -293;
+ if (s4.slen != 4)
+ return -294;
+ if (s4.ptr == NULL || *s4.ptr != 'A')
+ return -295;
+ if (pj_strtoul2(&s5, &s4, 16) != 0x123ABCDUL)
+ return -296;
+ if (s4.slen != 0)
+ return -297;
+
/*
* pj_create_random_string()
* Check that no duplicate strings are returned.