changeset 153:ce33adb482a7

added const tests
author thomask
date Thu, 25 Nov 2004 15:25:04 +0000
parents 5b69c210daee
children 505eb6178186
files nocompile/const_02.d nocompile/const_03.d nocompile/const_04.d nocompile/const_07.d nocompile/const_08.d nocompile/const_09.d nocompile/const_11.d run/const_05.d run/const_06.d run/const_10.d todo.txt
diffstat 11 files changed, 140 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/const_02.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,14 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+// altering a constant
+
+module dstress.nocompile.const_02;
+
+const int i = 9;
+
+int main(){
+	i++;
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/const_03.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,14 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+// altering a constant value
+
+module dstress.nocompile.const_03;
+
+const int i = 9;
+
+int main(){
+	i = 3;
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/const_04.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,11 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+// constant loop
+
+module dstress.nocompile.const_04;
+
+const int a = b+1;
+const int b = a+1;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/const_07.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,10 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+// Object allocation at compiletime is impossible
+
+module dstress.nocompile.const_07;
+
+const Object o = new Object();
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/const_08.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,14 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+// struct allocation at compiletime is impossible
+
+module dstress.nocompile.const_08;
+
+struct MyStruct{
+	int i;
+}
+
+const MyStruct* s = new MyStruct;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/const_09.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,15 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+// union allocation at compiletime is impossible
+
+module dstress.nocompile.const_07;
+
+union MyUnion{
+	int i;
+	Object o;
+}
+
+const MyUnion* u = new MyUnion();
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/const_11.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,13 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+module dstress.nocompile.const_11;
+
+struct MyStruct{
+	int i=2;
+}
+
+const MyStruct s;
+const MyStruct* sp = &s;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/const_05.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,16 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+module dstress.run.const_05;
+
+const int c = b + 1;
+const int a = 1;
+const int b = a + 1;
+
+int main(){
+	assert(a==1);
+	assert(b==2);
+	assert(c==3);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/const_06.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,16 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+module dstress.run.const_06;
+
+const int a = 1;
+const int b = a + 1;
+const int c = b + 1;
+
+int main(){
+	assert(a==1);
+	assert(b==2);
+	assert(c==3);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/const_10.d	Thu Nov 25 15:25:04 2004 +0000
@@ -0,0 +1,16 @@
+// $HeadURL$
+// $Date$
+// $URL$
+
+module dstress.run.const_10;
+
+struct MyStruct{
+	int i=2;
+}
+
+const MyStruct s;
+
+int main(){
+	assert(s.i==2);
+	return 0;
+}
--- a/todo.txt	Wed Nov 24 09:09:42 2004 +0000
+++ b/todo.txt	Thu Nov 25 15:25:04 2004 +0000
@@ -4,6 +4,7 @@
 
 Makefile:
 * fix analyse_run (tries to execute the destination, even if compiling failed)
+* check the Windows bat generator
 
 Benchmark:
 * integrate benchmark results: SciMark, cowell-shah, oopack, ackermann
@@ -16,7 +17,6 @@
 * keyword: cdouble
 * keyword: cfloat
 * keyword: char (test that it realy is unsigned)
-* keyword: const
 * keyword: continue
 * keyword: delegate
 * keyword: delete