aboutsummaryrefslogtreecommitdiff
path: root/patches/gollum.sh
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-02-14 18:36:09 -0500
committerDave Gauer <dave@ratfactor.com>2021-02-14 18:36:09 -0500
commit6ccd55729e5de45524337084b03eb5a89b9f3ac1 (patch)
treef6251d12905c2f7007415540173864c5a886b193 /patches/gollum.sh
parent95c8ea3cb3bde9427e2364e450a6cf443cdaba5e (diff)
downloadziglings-6ccd55729e5de45524337084b03eb5a89b9f3ac1.tar.gz
ziglings-6ccd55729e5de45524337084b03eb5a89b9f3ac1.tar.bz2
ziglings-6ccd55729e5de45524337084b03eb5a89b9f3ac1.tar.xz
ziglings-6ccd55729e5de45524337084b03eb5a89b9f3ac1.zip
Added testing ability
For the full details, see patches/README.md :-)
Diffstat (limited to 'patches/gollum.sh')
-rwxr-xr-xpatches/gollum.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/gollum.sh b/patches/gollum.sh
new file mode 100755
index 0000000..78c7756
--- /dev/null
+++ b/patches/gollum.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# "It isn't fair, my precious, is it,
+# to ask us what it's got in it's
+# nassty little pocketsess?"
+# Gollum, The Hobbit, or There and Back Again
+#
+
+cd $(dirname $(which $0))
+f=$(basename ../exercises/$1*.zig .zig 2> /dev/null)
+b=../exercises/$f.zig
+a=../answers/$f.zig
+p=$f.patch
+
+printf "\tf: '$f'\n\tb: '$b'\n\ta: '$a'\n"
+
+if [[ ! -f $b ]]; then echo "We hates it!"; exit 1; fi
+if [[ ! -a $a ]]; then echo "Where is it? Where is the answer, precious?"; exit; fi
+
+echo Hisssss!
+
+diff $b $a > $p
+
+cat $p