test/nocomments.sh

Thu, 23 Aug 2018 19:45:36 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 23 Aug 2018 19:45:36 +0200
changeset 57
68018eac46c3
parent 56
ed65f8c73fb2
child 68
ae763178ee1e
permissions
-rwxr-xr-x

adds simple tiny test suite and updates license headers

56
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 #!/bin/sh
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 #
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 #
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 # Copyright 2018 Mike Becker. All rights reserved.
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 #
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 # Redistribution and use in source and binary forms, with or without
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 # modification, are permitted provided that the following conditions are met:
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 #
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 # 1. Redistributions of source code must retain the above copyright
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 # notice, this list of conditions and the following disclaimer.
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 #
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 # 2. Redistributions in binary form must reproduce the above copyright
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 # notice, this list of conditions and the following disclaimer in the
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 # documentation and/or other materials provided with the distribution.
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 #
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 # POSSIBILITY OF SUCH DAMAGE.
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 #
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29
57
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
30 echo -n "Verifying correctness of line count without comments: "
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
31
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
32 clineprg="$(pwd)/../src/cline"
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
33
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
34 cd $srcdir
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
35 count=`$clineprg -Vs testfile.c --exclude-cstyle-comments`
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
36 expected=12
56
ed65f8c73fb2 adds test file skeleton to build system
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37
57
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
38 if [ "$count" -eq "$expected" ]; then
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
39 echo "OK."
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
40 exit 0;
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
41 else
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
42 echo "FAIL! $count is not $expected"
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
43 exit 1;
68018eac46c3 adds simple tiny test suite and updates license headers
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
44 fi

mercurial