bin/ai/regression/completeness.sh
author truelight
Fri, 19 Oct 2007 11:32:20 +0000
branchnoai
changeset 9711 c8b427215c9d
parent 9596 8af5a1399842
child 9812 4bc3062476c8
permissions -rwxr-xr-x
(svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
9564
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     1
#!/bin/sh
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     2
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     3
if ! [ -f ai/regression/regression.nut ]; then
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     4
	echo "Make sure you are in the root of OpenTTD before starting this script."
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     5
	exit 1
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     6
fi
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     7
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     8
cat ai/regression/regression.nut | awk '
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
     9
/^function/ {
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    10
	for (local in locals) {
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    11
		delete locals[local]
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    12
	}
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    13
	if (match($0, "function Regression::Start") || match($0, "function Regression::Stop")) next
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    14
	locals["this"] = "AIControllerSquirrel"
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    15
}
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    16
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    17
/local/ {
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    18
	gsub(".*local", "local")
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    19
	if (match($4, "^AI")) {
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    20
		sub("\\(.*", "", $4)
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    21
		locals[$2] = $4
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    22
	}
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    23
}
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    24
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    25
/\./ {
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    26
	for (local in locals) {
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    27
		if (match($0, local ".")) {
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    28
			fname = substr($0, index($0, local "."))
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    29
			sub("\\(.*", "", fname)
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    30
			sub("\\.", "::", fname)
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    31
			sub(local, locals[local], fname)
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    32
			print fname
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    33
		}
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    34
	}
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    35
}
9565
7237786c6197 (svn r9503) [NoAI] -Fix r9502: use tmp.XXX for temporary file-names instead of XXX.txt
truelight
parents: 9564
diff changeset
    36
' | sort | uniq > tmp.in_regression
9564
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    37
9596
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents: 9565
diff changeset
    38
grep 'DefSQ.*Method' ../src/ai/api/*.hpp.sq | grep -v '::GetClassName' | sed 's/^[^,]*, &//g;s/,[^,]*//g' | sort > tmp.in_api
9564
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    39
9565
7237786c6197 (svn r9503) [NoAI] -Fix r9502: use tmp.XXX for temporary file-names instead of XXX.txt
truelight
parents: 9564
diff changeset
    40
diff -u tmp.in_regression tmp.in_api | grep -v '^+++' | grep '^+' | sed 's/^+//'
9564
cd02879048c9 (svn r9502) [NoAI] -Add: script to check the 'completeness' of the regression test
rubidium
parents:
diff changeset
    41
9565
7237786c6197 (svn r9503) [NoAI] -Fix r9502: use tmp.XXX for temporary file-names instead of XXX.txt
truelight
parents: 9564
diff changeset
    42
rm -f tmp.in_regression tmp.in_api
7237786c6197 (svn r9503) [NoAI] -Fix r9502: use tmp.XXX for temporary file-names instead of XXX.txt
truelight
parents: 9564
diff changeset
    43