test_base64.t 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. set test bin path:
  2. $ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
  3. check that base64 is producing expected results:
  4. $ valgrind --quiet --leak-check=full test-b64
  5. 0
  6. 4 Zg==
  7. 4 Zm8=
  8. 4 Zm9v
  9. 8 Zm9vYg==
  10. 8 Zm9vYmE=
  11. 8 Zm9vYmFy
  12. 0
  13. 1 f
  14. 2 fo
  15. 3 foo
  16. 4 foob
  17. 5 fooba
  18. 6 foobar
  19. $ test-b64-san
  20. 0
  21. 4 Zg==
  22. 4 Zm8=
  23. 4 Zm9v
  24. 8 Zm9vYg==
  25. 8 Zm9vYmE=
  26. 8 Zm9vYmFy
  27. 0
  28. 1 f
  29. 2 fo
  30. 3 foo
  31. 4 foob
  32. 5 fooba
  33. 6 foobar
  34. check that b64_encode and b64_decode assert invalid input
  35. $ alias check="egrep '(dumped|Assertion)' output.log | sed 's;.*\(b64_.*code\).*\(Assertion.*$\);\1: \2;' | LC_ALL=C sort"
  36. $ test-b64_decode 2> output.log; check
  37. Aborted (core dumped)
  38. b64_decode: Assertion `dest && targsize > 0' failed.
  39. $ test-b64_encode 2> output.log; check
  40. Aborted (core dumped)
  41. b64_encode: Assertion `dest && targsize > 0' failed.
  42. $ test-b64_decode-san 2> output.log; check
  43. Aborted (core dumped)
  44. b64_decode: Assertion `dest && targsize > 0' failed.
  45. $ test-b64_encode-san 2> output.log; check
  46. Aborted (core dumped)
  47. b64_encode: Assertion `dest && targsize > 0' failed.