This commit also adds the first unit test. The unit test compares the phonetic map generated by the Python and by the C implementation and fails if the generated maps are different.
38 lines
906 B
Bash
Executable File
38 lines
906 B
Bash
Executable File
#!/bin/sh -ex
|
|
#
|
|
# Test Case:
|
|
#
|
|
# Use the Python and C implementations to produce the various tables. Compare
|
|
# if the generated files are identical for both.
|
|
#
|
|
# Environment:
|
|
#
|
|
# PHOGEN_MAP_C - should point to the C executable
|
|
# PHOGEN_MAP_PY - should point to the Python executable
|
|
# PHOGEN_WORD_LIST - word list
|
|
|
|
function on_exit()
|
|
{
|
|
rm -v /tmp/phogen_*_$$.h
|
|
rm -v /tmp/phogen_*_$$.json
|
|
rm -v /tmp/phogen_*_$$.py
|
|
}
|
|
|
|
trap on_exit EXIT
|
|
|
|
$PHOGEN_MAP_C \
|
|
--input "$PHOGEN_WORD_LIST" \
|
|
--clang "/tmp/phogen_c_$$.h" \
|
|
--python "/tmp/phogen_c_$$.py" \
|
|
--json "/tmp/phogen_c_$$.json"
|
|
|
|
$PHOGEN_MAP_PY \
|
|
--input "$PHOGEN_WORD_LIST" \
|
|
--clang "/tmp/phogen_py_$$.h" \
|
|
--python "/tmp/phogen_py_$$.py" \
|
|
--json "/tmp/phogen_py_$$.json"
|
|
|
|
cmp /tmp/phogen_c_$$.h /tmp/phogen_py_$$.h
|
|
cmp /tmp/phogen_c_$$.py /tmp/phogen_py_$$.py
|
|
cmp /tmp/phogen_c_$$.json /tmp/phogen_py_$$.json
|