summaryrefslogtreecommitdiff
path: root/mkunit.sh
diff options
context:
space:
mode:
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