a64l.c 512 B

12345678910111213141516171819202122
  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 1;
  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 1;
  16. }
  17. printf("Correct a64l: %s = %ld\n", s, l);
  18. return 0;
  19. }