summaryrefslogtreecommitdiff
path: root/tools/newtestclass
blob: 652f354c3bf5d0e62b23ca11aa1fa4ae0d32c999 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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