Add implementation for a64l

This commit is contained in:
Sebastian Würl
2018-03-11 11:48:05 +01:00
parent 8028c35172
commit d4d808fcc8
5 changed files with 48 additions and 2 deletions
+1
View File
@@ -29,6 +29,7 @@
/setid
/sprintf
/stdlib/strtol
/stdlib/a64l
/string/strncmp
/string/strcspn
/string/strchr
+1
View File
@@ -24,6 +24,7 @@ BINS=\
sleep \
sprintf \
stdlib/strtol \
stdlib/a64l \
string/strncmp \
string/strcspn \
string/strchr \
+22
View File
@@ -0,0 +1,22 @@
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
char * s = "azAZ9."; // test boundaries
long l = a64l(s);
if (l != 194301926) {
printf("Invalid result: a64l(%s) = %ld\n", s, l);
return 1;
}
printf("Correct a64l: %s = %ld\n", s, l);
s = "azA"; // test null terminated string
l = a64l(s);
if (l != 53222) {
printf("Invalid result: a64l(%s) = %ld\n", s, l);
return 1;
}
printf("Correct a64l: %s = %ld\n", s, l);
return 0;
}