27 lines
445 B
Bash
27 lines
445 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
dir=$(dirname "$(readlink -f "$0")")
|
||
|
trie="$dir/../trie.py"
|
||
|
|
||
|
read -r -d '' input <<EOF
|
||
|
a b x
|
||
|
a b c
|
||
|
a b c d
|
||
|
EOF
|
||
|
|
||
|
output=$(echo "$input" | "$trie")
|
||
|
|
||
|
# shellcheck disable=SC2086
|
||
|
result=$(eval 'for i in '$output' ; do echo "$i" ; done' | sort)
|
||
|
|
||
|
reference=$(echo "$input" | sort | uniq)
|
||
|
|
||
|
if test "$reference" = "$result" ; then
|
||
|
rv=0
|
||
|
else
|
||
|
printf 'ERROR: reference=\n%s\nresult=\n%s\n' "$reference" "$result"
|
||
|
rv=1
|
||
|
fi
|
||
|
|
||
|
exit $rv
|