btcs

bitcoin script parser/evaluator/compiler/decompiler
git clone git://jb55.com/btcs
Log | Files | Refs | README | LICENSE

run (617B)


      1 #!/usr/bin/env bash
      2 
      3 process () {
      4     tail -n+2 "$1" | sed -n '/^--- failing/q;p'
      5 }
      6 
      7 n=1
      8 c=$(($(process tests.csv | wc -l)))
      9 
     10 printf "1..%d\n" "$c"
     11 
     12 process tests.csv | \
     13 (fail=0
     14 while IFS=, read -r description args input expected
     15 do
     16     output=$(../btcs $args <<<"$input" 2>&1)
     17 	output2=${output//[$'\t\r\n']/ }
     18     if [ "$output2" == "$expected" ]; then
     19         printf "ok %d - %s\n" "$n" "$description"
     20     else
     21         printf "not ok %d - %s\n" "$n" "$description"
     22         printf "#\n#    got      '%s', \n#    expected '%s'\n#\n" "$output2" "$expected"
     23         fail=1
     24     fi
     25     n=$((n + 1))
     26 done
     27  exit $fail
     28 )
     29