tests: bonsai/npc.mk: full ASCII test coverage
This commit is contained in:
parent
ee7b7e89b2
commit
588680406a
@ -10,7 +10,11 @@
|
|||||||
.PRAGMA: command_comment
|
.PRAGMA: command_comment
|
||||||
|
|
||||||
.PHONY: npc_tests
|
.PHONY: npc_tests
|
||||||
npc_tests: npc_args npc_help
|
npc_tests: npc_help npc_args npc_ascii
|
||||||
|
|
||||||
|
.PHONY: npc_help
|
||||||
|
npc_help: $(BIN)/npc
|
||||||
|
! $(BIN)/npc -h
|
||||||
|
|
||||||
.PHONY: npc_args
|
.PHONY: npc_args
|
||||||
# arg parsing
|
# arg parsing
|
||||||
@ -20,23 +24,49 @@ npc_args:
|
|||||||
$(BIN)/npc -et </dev/null
|
$(BIN)/npc -et </dev/null
|
||||||
! $(BIN)/npc -et 5 </dev/null
|
! $(BIN)/npc -et 5 </dev/null
|
||||||
|
|
||||||
.PHONY: npc_help
|
.PHONY: npc_ascii
|
||||||
npc_help: $(BIN)/npc
|
# Test 0x00 to 0x7f in input; in other words, the full 7b ASCII range.
|
||||||
! $(BIN)/npc -h
|
npc_ascii: npc_ascii_controls npc_ascii_symbols npc_ascii_uppers # \
|
||||||
|
# npc_ascii_lowers
|
||||||
|
|
||||||
#i=0; while "$BIN"/intcmp -l $i 178; do
|
.PHONY: npc_ascii_controls
|
||||||
# printf '\\%s\\n' "$i" \
|
# (control characters)
|
||||||
# | xargs -I fmt printf fmt
|
npc_ascii_controls:
|
||||||
#
|
# ASCII 0x00 to 0x0a (before the newline, due to xargs(1p) issues)
|
||||||
# # simulate octal
|
awk 'BEGIN{ for (i = 0; i < 32; ++i) printf("%c", i); }' \
|
||||||
# i="$(printf '1 + %s\n' "$i" | bc)"
|
| $(BIN)/npc \
|
||||||
# printf '%s\n' "$i" \
|
| head -n 1 \
|
||||||
# | tail -c 1 \
|
| xargs -I out test "^@^A^B^C^D^E^F^G^H" = out
|
||||||
# | xargs "$BIN"/intcmp -e 8 \
|
|
||||||
# && i="$(printf '2 + %s\n' "$i" | bc)"
|
# ASCII 0x0a (otherwise the head|tail sequence won't work) to 0x1f
|
||||||
# printf '%s\n' "$i" \
|
awk 'BEGIN{ for (i = 0; i < 32; ++i) printf("%c", i); print }' \
|
||||||
# | tail -c 2 \
|
| $(BIN)/npc \
|
||||||
# | dd count=1 bs=1 2>/dev/null \
|
| head -n 2 \
|
||||||
# | xargs "$BIN"/intcmp -e 8 \
|
| tail -n 1 \
|
||||||
# && i="$(printf '20 + %s\n' "$i" | bc)"
|
| xargs -I out test "^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_"
|
||||||
#done
|
|
||||||
|
.PHONY: npc_ascii_symbols
|
||||||
|
# ASCII 0x1f to 0x3f (^_ and symbols)
|
||||||
|
npc_ascii_symbols:
|
||||||
|
# shell quoting olympics
|
||||||
|
awk 'BEGIN{ for (i = 31; i < 64; ++i) printf("%c", i); print }' \
|
||||||
|
| $(BIN)/npc \
|
||||||
|
| sed -e s"/\'/\\\'/g" -e 's/"/\\"/g' \
|
||||||
|
| xargs -I out test "^_ !\"#$$%&'()*+,-./0123456789:;<=>?" = out
|
||||||
|
|
||||||
|
.PHONY: npc_ascii_uppers
|
||||||
|
# ASCII 0x40 to 0x5f (uppercases)
|
||||||
|
npc_ascii_uppers:
|
||||||
|
awk 'BEGIN{ for (i = 64; i < 96; ++i) printf("%c", i); print }' \
|
||||||
|
| $(BIN)/npc \
|
||||||
|
| sed 's/\\/\\\\/' \
|
||||||
|
| xargs -I out test @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ = out
|
||||||
|
|
||||||
|
# This test is broken and will need closer inspection along with the npc(1)
|
||||||
|
# source.
|
||||||
|
# .PHONY: npc_ascii_lowers
|
||||||
|
# # ASCII 0x60 to 0x7f (lowercases)
|
||||||
|
# npc_ascii_lowers:
|
||||||
|
# awk 'BEGIN{ for (i = 96; i < 128; ++i) printf("%c", i); print }' \
|
||||||
|
# | $(BIN)/npc \
|
||||||
|
# | xargs -I out test "\`abcdefghijklmnopqrstuvwxyz{|}~^?" = out
|
||||||
|
Loading…
Reference in New Issue
Block a user