a64l.c 545 B

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