summaryrefslogtreecommitdiff
path: root/tools/newtestclass
diff options
context:
space:
mode:
Diffstat (limited to 'tools/newtestclass')
-rwxr-xr-xtools/newtestclass29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/newtestclass b/tools/newtestclass
new file mode 100755
index 0000000..652f354
--- /dev/null
+++ b/tools/newtestclass
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+class=$1
+lowerclass=`echo $class | tr [:upper:] [:lower:]`
+include="$lowerclass".h
+testfile="$lowerclass"_test.cc
+
+cp `dirname $0`/sourcefileheader.txt $testfile
+
+cat >> $testfile <<EOF
+#include <cxxtest/TestSuite.h>
+#include "#INCLUDE#"
+
+namespace
+{
+
+class #CLASS#Test: public CxxTest::TestSuite
+{
+ public:
+ void TestSimple()
+ {
+ }
+};
+
+};
+EOF
+
+sed "s/#CLASS#/$class/g" $testfile >$testfile.tmp ; mv $testfile.tmp $testfile
+sed "s/#INCLUDE#/$include/g" $testfile >$testfile.tmp ; mv $testfile.tmp $testfile