summaryrefslogtreecommitdiff
path: root/mkunit.sh
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-15 07:44:10 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-15 07:44:10 +0000
commit306b80c1cf9ab490a83b36d3e7cf07e09f9e5d68 (patch)
tree32c35f8507edb4ea403f4ebc4b625c1096f6f384 /mkunit.sh
parent11413d228bae2919fe69c83b74c7ff49209dd65a (diff)
downloadlibbu++-306b80c1cf9ab490a83b36d3e7cf07e09f9e5d68.tar.gz
libbu++-306b80c1cf9ab490a83b36d3e7cf07e09f9e5d68.tar.bz2
libbu++-306b80c1cf9ab490a83b36d3e7cf07e09f9e5d68.tar.xz
libbu++-306b80c1cf9ab490a83b36d3e7cf07e09f9e5d68.zip
mkunit.sh was a little dumb, it didn't handle a number of things correctly.
I've written a new program that basically does the same thing, only it's much more clever, and does many more of the translations and conversions better, including the #line directives. Also, I dropped nids, we don't need it anymore. But now I'm ready to write some serious tests for myriad.
Diffstat (limited to 'mkunit.sh')
-rwxr-xr-xmkunit.sh38
1 files changed, 0 insertions, 38 deletions
diff --git a/mkunit.sh b/mkunit.sh
deleted file mode 100755
index b99b6d3..0000000
--- a/mkunit.sh
+++ /dev/null
@@ -1,38 +0,0 @@
1#!/bin/bash
2
3inputfile="$1"
4
5function mkfunc()
6{
7 line=$(grep -nh "{%$1" "$inputfile")
8 echo "#line ${line%%:*} \"$inputfile\" \\"
9 echo "void $1() /**< expect ${2:-pass} */"
10}
11
12function mkadd()
13{
14 ex="expectPass"
15 if [ "$2" == "fail" ]; then
16 ex="expectFail"
17 fi
18 echo "\\\\tadd( static_cast<Bu::UnitSuite::Test>(\\&Unit::$1), \"$1\", Bu::UnitSuite::${ex} );\\\\n"
19}
20
21sedbits=""
22init="#include \"bu/unitsuite.h\"\\\\n\\\\nclass Unit : public Bu::UnitSuite\\\\n{\\\\npublic:\\\\n\\\\nUnit()\\\\n{\\\\n\\\\tsetName(\"${1%.*}\");\\\\n"
23for i in $(grep {% "$1"); do
24 sedbits="${sedbits}s@${i}@$(mkfunc $(echo $i | sed -e 's/.*{%\(.*\)}/\1/' -e 's/:/ /g'))@\n"
25 init="${init}$(mkadd $(echo $i | sed -e 's/.*{%\(.*\)}/\1/' -e 's/:/ /g'))"
26done
27
28init="${init}\\\\n}\\\\n\\\\nvirtual ~Unit() { }\\\\n\\\\n"
29
30sedbits="${sedbits}s@.*{=Init}@${init}@\n"
31
32temp=$(mktemp)
33echo -e "$sedbits" > $temp
34sed -f $temp $1 > $2
35echo -e "\n};\n\nint main( int argc, char *argv[] )\n{\n\treturn Unit().run( argc, argv );\n}\n" >> $2
36
37rm $temp
38