[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.

This commit is contained in:
Tomas Lindquist Olsen
2008-07-13 02:51:19 +02:00
parent d1e41f611e
commit cecb64b2e4
339 changed files with 388 additions and 172 deletions
-25
View File
@@ -1,25 +0,0 @@
class Foo
{
int i;
}
class Bar : Foo
{
int j;
}
void func()
{
scope c = new Bar;
func2(c);
}
void func2(Bar c)
{
c.i = 123;
}
void main()
{
func();
}
-8
View File
@@ -1,8 +0,0 @@
char* toStringz (char[] s)
{
if (s.ptr)
if (! (s.length && s[$-1] is 0))
s = s ~ '\0';
return s.ptr;
}
-9
View File
@@ -1,9 +0,0 @@
extern(C)
{
private extern int integer;
}
void func()
{
integer++;
}
-27
View File
@@ -1,27 +0,0 @@
extern(C) int printf(char*,...);
class MyClass
{
this(int i = 4)
{
inner = this.new InnerClass;
}
class InnerClass : Object.Monitor
{
void lock() {}
void unlock() {}
}
InnerClass inner;
}
void func()
{
scope c = new MyClass(42);
}
void main()
{
func();
}
-6
View File
@@ -1,6 +0,0 @@
extern(C) int printf(char*,...);
void main()
{
printf("Hello World!\n");
}
-18
View File
@@ -1,18 +0,0 @@
extern(C) int printf(char*, ...);
int main(char[][] args)
{
printf("getint\n");
int i = getint();
printf("assert true\n");
assert(i == 1234);
printf("assert false\n");
assert(i != 1234);
printf("return\n");
return 0;
}
int getint()
{
return 1234;
}
-22
View File
@@ -1,22 +0,0 @@
class E : Exception
{
this(char[] msg)
{
super(msg);
}
char[] toString()
{
return super.toString();
}
}
extern(C) int printf(char*, ...);
void main()
{
auto e = new E("hello world");
auto msg = e.toString();
printf("message should be: '%.*s'\n", msg.length, msg.ptr);
throw e;
}
-12
View File
@@ -1,12 +0,0 @@
module tangotests.nested1;
void main()
{
int i = 42;
assert(i == 42);
void func()
{
assert(i == 42);
}
func();
}
-12
View File
@@ -1,12 +0,0 @@
module fail1;
void func()
{
float* fp;
float f = *fp;
}
void main()
{
func();
}
-27
View File
@@ -1,27 +0,0 @@
module fail2;
void a()
{
b();
}
void b()
{
c();
}
void c()
{
d();
}
void d()
{
int* ip;
int i = *ip;
}
void main()
{
a();
}
View File
View File
View File
+1 -1
View File
@@ -1,4 +1,4 @@
module tangotests.aa1;
module tangotests.aa1_1;
extern(C) int printf(char*,...);
View File
+12
View File
@@ -0,0 +1,12 @@
module tangotests.aa2_1;
int main()
{
int[cdouble] x;
cdouble d=22.0+0.0i;
x[d] = 44;
if(44 != x[d]){
assert(0);
}
return 0;
}
View File
View File
View File
View File
+19
View File
@@ -0,0 +1,19 @@
module tangotests.align1;
extern(C) int printf(char*, ...);
struct TLA
{
char[3] tla;
char[] toString() { return tla; }
void dump()
{
printf("%.*s\n", 3, tla.ptr);
}
}
void main()
{
TLA fbi = TLA("FBI");
fbi.dump();
}
+43
View File
@@ -0,0 +1,43 @@
module arrays1;
extern(C) int printf(char*, ...);
void integer()
{
auto arr = new int[16];
arr[1] = 42;
arr[6] = 555;
print_int(arr);
delete arr;
}
void floating()
{
auto arr = new float[6];
arr[1] = 3.14159265;
arr[3] = 1.61803399;
print_float(arr);
delete arr;
}
void print_int(int[] arr)
{
printf("arr[%lu] = [", arr.length);
for (auto i=0; i<arr.length; i++)
printf("%d,", arr[i]);
printf("\b]\n");
}
void print_float(float[] arr)
{
printf("arr[%lu] = [", arr.length);
for (auto i=0; i<arr.length; i++)
printf("%f,", arr[i]);
printf("\b]\n");
}
void main()
{
integer();
floating();
}
+6
View File
@@ -0,0 +1,6 @@
module tangotests.arrays3;
void main()
{
const char[2][2] id = [1: "ab"];
}
View File
+1 -1
View File
@@ -1,4 +1,4 @@
module tangotests.asm1;
module tangotests.asm1_1;
extern(C) int printf(char*, ...);
+20
View File
@@ -0,0 +1,20 @@
module tangotests.asm5;
extern(C) int printf(char*, ...);
void main()
{
int i = func();
printf("%d\n", i);
assert(i == 42);
}
int func()
{
asm
{
naked;
mov EAX, 42;
ret;
}
}
+23
View File
@@ -0,0 +1,23 @@
extern(C) int printf(char*, ...);
void main()
{
int a,b,c;
a = int.max-1;
b = 1;
asm
{
mov EAX, a;
mov ECX, b;
add EAX, ECX;
jo Loverflow;
mov c, EAX;
}
printf("c == %d\n", c);
assert(c == a+b);
return;
Loverflow:
assert(0, "overflow");
}
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File

Some files were not shown because too many files have changed in this diff Show More