a64l.c 520 B

123456789101112131415161718192021
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. int main(void) {
  4. char * s = "azAZ9."; // test boundaries
  5. long l = a64l(s);
  6. if (l != 194301926) {
  7. printf("Invalid result: a64l(%s) = %ld\n", s, l);
  8. return EXIT_FAILURE;
  9. }
  10. printf("Correct a64l: %s = %ld\n", s, l);
  11. s = "azA"; // test null terminated string
  12. l = a64l(s);
  13. if (l != 53222) {
  14. printf("Invalid result: a64l(%s) = %ld\n", s, l);
  15. return EXIT_FAILURE;
  16. }
  17. printf("Correct a64l: %s = %ld\n", s, l);
  18. }