changeset 170:7f00d03c4016

added basic offsetof tests
author thomask
date Wed, 01 Dec 2004 12:37:59 +0000
parents d7e8a8ec71d4
children e2ba37f5b797
files nocompile/offsetof_03.d run/offsetof_01.d run/offsetof_02.d
diffstat 3 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/offsetof_03.d	Wed Dec 01 12:37:59 2004 +0000
@@ -0,0 +1,20 @@
+// $HeadURL$
+// $Date$
+// Author$
+
+module dstress.nocompile.offsetof_03;
+
+union MyUnion{
+	int a;
+	int b;	
+}
+
+int main(){
+	MyUnion u;
+
+	assert(u.a.offsetof >= 0);
+	assert(u.b.offsetof >= 0);
+	assert(u.a.offsetof != u.b.offsetof);
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/offsetof_01.d	Wed Dec 01 12:37:59 2004 +0000
@@ -0,0 +1,20 @@
+// $HeadURL$
+// $Date$
+// Author$
+
+module dstress.run.offsetof_01;
+
+struct MyStruct{
+	int a;
+	int b;	
+}
+
+int main(){
+	MyStruct s;
+
+	assert(s.a.offsetof >= 0);
+	assert(s.b.offsetof >= 0);
+	assert(s.a.offsetof != s.b.offsetof);
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/offsetof_02.d	Wed Dec 01 12:37:59 2004 +0000
@@ -0,0 +1,20 @@
+// $HeadURL$
+// $Date$
+// Author$
+
+module dstress.run.offsetof_02;
+
+class MyClass{
+	int a;
+	int b;	
+}
+
+int main(){
+	MyClass c;
+
+	assert(c.a.offsetof >= 0);
+	assert(c.b.offsetof >= 0);
+	assert(c.a.offsetof != c.b.offsetof);
+
+	return 0;
+}