bcalc

cli bitcoin unit calculator
git clone git://jb55.com/bcalc
Log | Files | Refs | README | LICENSE

commit 8c0aac1f1432a6c2ab9a4a6bfd2a825705321b88
parent 0dbe2338be22fd4ce636f2dc4207accbd3e72589
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 19 Dec 2017 12:23:38 -0800

test: simple functional tests

Diffstat:
Atest/run | 18++++++++++++++++++
Atest/tests.csv | 2++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/test/run b/test/run @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +n=1 +c=$(wc -l < tests.csv) + +printf "1..%d\n" "$c" + +while IFS=, read -r description args input expected +do + output=$(../bcalc $args <<<"$input") + if [ "$output" != "$expected" ]; then + printf "not ok %d - %s\n" "$n" "$description" + printf "#\n# got '%s', expected '%s'\n#\n" "$output" "$expected" + else + printf "ok %d - %s\n" "$n" "$description" + fi + n=$((n + 1)) +done < tests.csv diff --git a/test/tests.csv b/test/tests.csv @@ -0,0 +1,2 @@ +scalar division,--btc -p,1 BTC / 10,0.1 BTC +scalar multiplication,--btc,10 * 1 BTC,1