base64_test.c 484 B

1234567891011121314151617181920
  1. #include "test.h"
  2. int base64_test(void)
  3. {
  4. unsigned char in[64], out[256], tmp[64];
  5. unsigned long x, l1, l2;
  6. for (x = 0; x < 64; x++) {
  7. yarrow_read(in, x, &test_yarrow);
  8. l1 = sizeof(out);
  9. DO(base64_encode(in, x, out, &l1));
  10. l2 = sizeof(tmp);
  11. DO(base64_decode(out, l1, tmp, &l2));
  12. if (l2 != x || memcmp(tmp, in, x)) {
  13. printf("base64 failed %lu %lu %lu", x, l1, l2);
  14. return 1;
  15. }
  16. }
  17. return 0;
  18. }