File: test

package info (click to toggle)
widelands 1%3A17-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 332,404 kB
  • sloc: cpp: 104,978; python: 3,073; ada: 855; sh: 435; makefile: 225
file content (23 lines) | stat: -rwxr-xr-x 628 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /bin/bash

declare -i TESTS=0
declare -i ERRORS=0
for TEST in *; do
	if [ -d $TEST ]; then
		[[ -f $TEST/forbidden ]] && if [ "$(egrep -f $TEST/regexps $TEST/forbidden | wc -l)" != "$(wc -l < $TEST/forbidden)" ]; then
			echo "$TEST failed to match all forbidden cases"
			ERRORS+=1
		fi
		[[ -f $TEST/allowed ]] && if [ "$(egrep -f $TEST/regexps $TEST/allowed | wc -l)" != "0" ]; then
			echo "$TEST detected an allowed case as forbidden"
			ERRORS+=1
		fi
		TESTS+=1
	fi
done
if [ $ERRORS == 0 ]; then
	echo "All $TESTS rules passed their tests"
else
	echo "$ERRORS errors were found during the rule tests"
fi
exit $ERRORS