hexdump.tests 719 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # Copyright 2018 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 'hexdump -C with four NULs' \
  7. 'hexdump -C' \
  8. "\
  9. 00000000 00 00 00 00 |....|
  10. 00000004
  11. " \
  12. '' \
  13. '\0\0\0\0'
  14. testing "hexdump does not think last padded block matches any full block" \
  15. "hexdump -e '1/1 \"%02x|\"1/1 \"%02x!\\n\"'" \
  16. "\
  17. 00|00!
  18. *
  19. 00| !
  20. " \
  21. '' \
  22. '\0\0\0\0\0\0\0\0\0\0\0'
  23. testing "hexdump thinks last full block can match" \
  24. "hexdump -e '1/1 \"%02x|\"1/1 \"%02x!\\n\"'" \
  25. "\
  26. 00|00!
  27. *
  28. " \
  29. '' \
  30. '\0\0\0\0\0\0\0\0\0\0\0\0'
  31. exit $FAILCOUNT