Sha256: 8be593a93e1378fc09c52d0d83d0f05ca7224da6c9cb59f2581e1083dc253b19

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

#!/bin/sh
# Test if chmd_md5 expands chm files identically to Microsoft's HH.EXE -DECOMPILE

[ -d .cache ] || mkdir .cache

for chm in "$@"
do
    echo "test $chm"
    cached=`echo $chm | sed -e 's/\//-/g' -e 's/^/.cache\//'`
    if [ ! -s $cached ]; then
        ./msdecompile_md5 $chm >.orig.out 2>.orig.err
        if [ -s .orig.err ]; then
            echo "FAIL $chm: MS errors" >&2
            cat .orig.err >&2
        else
            sort -k2 .orig.out >$cached
        fi
    fi

    ./chmd_md5 $chm >.test.out 2>.test.err
    perl -pe 'if($.>1){$_=""if/^[0-9a-f]{32} \/[#\$]/;s{ /}{  }}' .test.out | sort -k2 >.test.sorted
    if [ -s .test.err ]; then
        echo "FAIL $chm: errors" >&2
        cat .test.err >&2
    fi

    if cmp $cached .test.sorted >/dev/null; then
        echo "OK   $chm"
    else
       if [ `diff $cached .test.sorted | grep -c '^<'` -gt 0 ]; then
           echo "FAIL $chm: differences" >&2
           diff -u $cached .test.sorted >&2
       else
           echo "OK   $chm (better than hh.exe)"
       fi
    fi
done
rm -f .orig.out .orig.err .test.out .test.err .test.sorted

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/libmspack-0.1.0/ext/libmspack/test/chmd_compare
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/libmspack-0.1.0/ext/libmspack/test/chmd_compare
libmspack-0.1.0 ext/libmspack/test/chmd_compare
libmspack-0.0.5 ext/libmspack/test/chmd_compare
libmspack-0.0.4 ext/libmspack/test/chmd_compare
libmspack-0.0.3 ext/libmspack/test/chmd_compare
libmspack-0.0.2 ext/libmspack/test/chmd_compare
libmspack-0.0.1 ext/libmspack/test/chmd_compare