From c0994385c3a25e38b602187e49a995c937d62858 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 17 Aug 2014 17:01:01 +0000 Subject: [PATCH] Test suite using base58 CLI tool --- .gitignore | 3 +++ Makefile.am | 12 ++++++++++++ tests/decode-b58c-fail.sh | 2 ++ tests/decode-b58c-null.sh | 3 +++ tests/decode-b58c.sh | 3 +++ tests/decode.sh | 3 +++ tests/encode-b58c.sh | 3 +++ tests/encode-fail.sh | 3 +++ tests/encode.sh | 3 +++ 9 files changed, 35 insertions(+) create mode 100644 tests/decode-b58c-fail.sh create mode 100644 tests/decode-b58c-null.sh create mode 100644 tests/decode-b58c.sh create mode 100644 tests/decode.sh create mode 100644 tests/encode-b58c.sh create mode 100644 tests/encode-fail.sh create mode 100755 tests/encode.sh diff --git a/.gitignore b/.gitignore index dc3e8c7..44cf2ea 100644 --- a/.gitignore +++ b/.gitignore @@ -12,11 +12,14 @@ config.* *.lo autom4te.cache ar-lib +test-driver aclocal.m4 Makefile Makefile.in .deps +*.log .libs ii *.tar* base58 +tests/*.trs diff --git a/Makefile.am b/Makefile.am index b6957ef..b6f8785 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,3 +20,15 @@ bin_PROGRAMS = base58 base58_SOURCES = clitool.c base58_CFLAGS = $(LIBGCRYPT_CFLAGS) base58_LDADD = libbase58.la $(LIBGCRYPT_LIBS) + +TESTS = \ + tests/decode.sh \ + tests/decode-b58c.sh \ + tests/decode-b58c-fail.sh \ + tests/decode-b58c-null.sh \ + tests/encode.sh \ + tests/encode-b58c.sh \ + tests/encode-fail.sh +TEST_EXTENSIONS = .sh +SH_LOG_COMPILER = /bin/sh +AM_TESTS_ENVIRONMENT = PATH='$(srcdir)':"$$PATH"; export PATH; diff --git a/tests/decode-b58c-fail.sh b/tests/decode-b58c-fail.sh new file mode 100644 index 0000000..15fefe1 --- /dev/null +++ b/tests/decode-b58c-fail.sh @@ -0,0 +1,2 @@ +#!/bin/sh +! base58 -d 25 -c 19DXstMaV43WpYg4ceREiiTv2UntmoiA9a >/dev/null \ No newline at end of file diff --git a/tests/decode-b58c-null.sh b/tests/decode-b58c-null.sh new file mode 100644 index 0000000..81a25ec --- /dev/null +++ b/tests/decode-b58c-null.sh @@ -0,0 +1,3 @@ +#!/bin/sh +hex=$(base58 -d 25 -c 19DXstMaV43WpYg4ceREiiTv2UntmoiA9a | xxd -p) +test x$hex = x diff --git a/tests/decode-b58c.sh b/tests/decode-b58c.sh new file mode 100644 index 0000000..36ce430 --- /dev/null +++ b/tests/decode-b58c.sh @@ -0,0 +1,3 @@ +#!/bin/sh +hex=$(base58 -d 25 -c 19DXstMaV43WpYg4ceREiiTv2UntmoiA9j | xxd -p) +test x$hex != x005a1fc5dd9e6f03819fca94a2d89669469667f9a1 diff --git a/tests/decode.sh b/tests/decode.sh new file mode 100644 index 0000000..330d4db --- /dev/null +++ b/tests/decode.sh @@ -0,0 +1,3 @@ +#!/bin/sh +hex=$(base58 -d 25 19DXstMaV43WpYg4ceREiiTv2UntmoiA9j | xxd -p) +test x$hex != x005a1fc5dd9e6f03819fca94a2d89669469667f9a1 diff --git a/tests/encode-b58c.sh b/tests/encode-b58c.sh new file mode 100644 index 0000000..1f31780 --- /dev/null +++ b/tests/encode-b58c.sh @@ -0,0 +1,3 @@ +#!/bin/sh +b58=$(echo '005a1fc5dd9e6f03819fca94a2d89669469667f9a0' | xxd -r -p | base58 -c) +test x$b58 = x19DXstMaV43WpYg4ceREiiTv2UntmoiA9j diff --git a/tests/encode-fail.sh b/tests/encode-fail.sh new file mode 100644 index 0000000..398016a --- /dev/null +++ b/tests/encode-fail.sh @@ -0,0 +1,3 @@ +#!/bin/sh +b58=$(echo '005a1fc5dd9e6f03819fca94a2d89669469667f9a174655946' | xxd -r -p | base58) +test x$b58 != x19DXstMaV43WpYg4ceREiiTv2UntmoiA9j diff --git a/tests/encode.sh b/tests/encode.sh new file mode 100755 index 0000000..54ea713 --- /dev/null +++ b/tests/encode.sh @@ -0,0 +1,3 @@ +#!/bin/sh +b58=$(echo '005a1fc5dd9e6f03819fca94a2d89669469667f9a074655946' | xxd -r -p | base58) +test x$b58 = x19DXstMaV43WpYg4ceREiiTv2UntmoiA9j