xxd.tests 669 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. # Copyright 2020 by Denys Vlasenko <vda.linux@googlemail.com>
  3. # Licensed under GPLv2, see file LICENSE in this source tree.
  4. . ./testing.sh
  5. # testing "description" "command" "result" "infile" "stdin"
  6. testing 'xxd -p with one NUL' \
  7. 'xxd -p' \
  8. "\
  9. 00
  10. " \
  11. '' \
  12. '\0'
  13. testing 'xxd -p with 30 NULs' \
  14. 'xxd -p' \
  15. "\
  16. 000000000000000000000000000000000000000000000000000000000000
  17. " \
  18. '' \
  19. '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
  20. testing 'xxd -p with 31 NULs' \
  21. 'xxd -p' \
  22. "\
  23. 000000000000000000000000000000000000000000000000000000000000
  24. 00
  25. " \
  26. '' \
  27. '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
  28. exit $FAILCOUNT