--- /dev/null
+/*
+ * Acess2 C Library (Test)
+ * - By John Hodge (thePowersGang)
+ *
+ * TEST_strtoi.c
+ * - Tests for strtoi.c
+ */
+#include <stdio.h>
+
+#define TST(t, class, base, val, exp, fmt) do {\
+ t ret = strto##class(#val, NULL, base); \
+ if( ret != exp ) \
+ printf("FAIL strto"#class"('"#val"') != "#val" (act 0x"fmt")\n", ret);\
+}while(0)
+
+int main(int argc, char *argv[])
+{
+ TST(unsigned long, ul, 0, 0x10ec, 0x10ec, "%x");
+}
if( '0' <= *str && *str <= '9' )
next = *str - '0';
if( 'A' <= *str && *str <= 'A'+base-10-1 )
- next = *str - 'A';
+ next = *str - 'A' + 10;
if( 'a' <= *str && *str <= 'a'+base-10-1 )
- next = *str - 'a';
+ next = *str - 'a' + 10;
}
if( next < 0 )
break;