Add basic testing scripts

This commit is contained in:
Hackerpilot 2015-01-29 20:55:13 -08:00
parent 387a65e4f1
commit aad9201e58
10 changed files with 173 additions and 0 deletions

3
.gitignore vendored
View File

@ -15,3 +15,6 @@ callgrind.*
# Git hash file
githash.txt
# Test results
tests/tc*/actual.txt

27
tests/run_tests.sh Executable file
View File

@ -0,0 +1,27 @@
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
NORMAL="\033[0m"
fail_count=0
pass_count=0
for testCase in tc*; do
cd $testCase;
./run.sh;
if [ $? -eq 0 ]; then
echo -e "${YELLOW}$testCase:${NORMAL} ... ${GREEN}Pass${NORMAL}";
let pass_count=pass_count+1
else
echo -e "${YELLOW}$testCase:${NORMAL} ... ${RED}Fail${NORMAL}";
let fail_count=fail_count+1
fi
cd - > /dev/null;
done
if [ $fail_count -eq 0 ]; then
echo -e "${GREEN}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
else
echo -e "${RED}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
exit 1
fi

66
tests/tc001/expected.txt Normal file
View File

@ -0,0 +1,66 @@
identifiers
algorithm M
allocator M
array M
ascii M
base64 M
bigint M
bitmanip M
c P
compiler M
complex M
concurrency M
container M
conv M
cstream M
csv M
d P
datetime M
demangle M
digest P
encoding M
exception M
experimental P
file M
format M
functional M
getopt M
internal P
json M
lexer M
math M
mathspecial M
metastrings M
mmfile M
net P
numeric M
outbuffer M
parallelism M
path M
process M
random M
range M
regex M
signals M
socket M
socketstream M
stdint M
stdio M
stdiobase M
stream M
string M
syserror M
system M
traits M
typecons M
typelist M
typetuple M
uni M
uri M
utf M
uuid M
variant M
windows P
xml M
zip M
zlib M

1
tests/tc001/file.d Normal file
View File

@ -0,0 +1 @@
import std.

5
tests/tc001/run.sh Executable file
View File

@ -0,0 +1,5 @@
set -e
set -u
dcd-client file.d -c12 > actual.txt
diff actual.txt expected.txt

9
tests/tc002/expected.txt Normal file
View File

@ -0,0 +1,9 @@
identifiers
alignof k
init k
mangleof k
sizeof k
stringof k
tupleof k
x v
y v

1
tests/tc002/file.d Normal file
View File

@ -0,0 +1 @@
struct S { int x; int y; } void doStuff() { S s; s. }

5
tests/tc002/run.sh Executable file
View File

@ -0,0 +1,5 @@
set -e
set -u
dcd-client file.d -c52 > actual.txt
diff actual.txt expected.txt

51
tests/tc003/file.d Normal file
View File

@ -0,0 +1,51 @@
abstract class InheritMe(T)
{
final abstract class GrandChild(U, V)
{
/// I am uvalue
static U uvalue;
/// I am vvalue
static V vvalue;
/// I am setGrandChild
static void setGrandChild(alias X, alias Y)()
{
X = Y;
}
}
}
final abstract class Parent(T)
{
/// I am stringChild
final abstract class StringChild : InheritMe!(string)
{
/// I am a string GrandChild
alias s = GrandChild!(T, string);
/// I am an int GrandChild
alias i = GrandChild!(T, int);
}
/// I am a parentF
static void parentF()
{
}
}
/// I am stringParent
alias stringParent = Parent!string;
void main(string[] args)
{
with(stringParent.StringChild.s)
{
setGrandChild
!(
uvalue, "test",
)();
}
}

5
tests/tc003/run.sh Executable file
View File

@ -0,0 +1,5 @@
set -e
set -u
dcd-client file.d -c863 > actual.txt
diff actual.txt expected.txt