codea: First Round of Testcases and updates
authorMartin Perner <martin@perner.cc>
Sat, 15 May 2010 16:39:56 +0000 (18:39 +0200)
committerMartin Perner <martin@perner.cc>
Sat, 15 May 2010 16:39:56 +0000 (18:39 +0200)
Added 3 Testcases

Changes Instr. count for 3 other testcases

15 files changed:
codea/lewurm_07.instr
codea/lewurm_10.instr
codea/skinner33_00.0 [new file with mode: 0644]
codea/skinner33_00.call [new file with mode: 0644]
codea/skinner33_00.instr [new file with mode: 0644]
codea/skinner33_01.0 [new file with mode: 0644]
codea/skinner33_01.call [new file with mode: 0644]
codea/skinner33_01.instr [new file with mode: 0644]
codea/skinner33_02.0 [new file with mode: 0644]
codea/skinner33_02.call [new file with mode: 0644]
codea/skinner33_02.instr [new file with mode: 0644]
codea/skinner33_03.0 [new file with mode: 0644]
codea/skinner33_03.call [new file with mode: 0644]
codea/skinner33_03.instr [new file with mode: 0644]
codea/snafu_03.instr

index 8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6..9902f17848a8974ab57d57999b74a63198fe6e23 100644 (file)
@@ -1 +1 @@
-35
+28
index f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2..48082f72f087ce7e6fa75b9c41d7387daecd447b 100644 (file)
@@ -1 +1 @@
-10
+12
diff --git a/codea/skinner33_00.0 b/codea/skinner33_00.0
new file mode 100644 (file)
index 0000000..b8ed559
--- /dev/null
@@ -0,0 +1,11 @@
+method w()
+       return not this;
+end;
+
+method x()
+       return not (not this);
+end;
+
+method y()
+       return not (not (not this));
+end;
diff --git a/codea/skinner33_00.call b/codea/skinner33_00.call
new file mode 100644 (file)
index 0000000..bc046a1
--- /dev/null
@@ -0,0 +1,5 @@
+long w(long);
+long x(long);
+long y(long);
+
+RET(w(6)==0 && x(4)==1 && y(8)==0 && w(5) == 0 && x(3) == 1 && y(7) == 0 && w(0) == 1 && x(0) == 0 && y(0) == 1);
diff --git a/codea/skinner33_00.instr b/codea/skinner33_00.instr
new file mode 100644 (file)
index 0000000..7facc89
--- /dev/null
@@ -0,0 +1 @@
+36
diff --git a/codea/skinner33_01.0 b/codea/skinner33_01.0
new file mode 100644 (file)
index 0000000..25fab69
--- /dev/null
@@ -0,0 +1,23 @@
+method w()
+       return not 0;
+end;
+
+method x()
+       return not (not 0);
+end;
+
+method y()
+       return not 3;
+end;
+
+method z()
+       return not (not 3);
+end;
+
+method aa()
+       return not (not (not 0));
+end;
+
+method ab()
+       return not (not (not 3));
+end;
diff --git a/codea/skinner33_01.call b/codea/skinner33_01.call
new file mode 100644 (file)
index 0000000..af3f291
--- /dev/null
@@ -0,0 +1,8 @@
+long w(long);
+long x(long);
+long y(long);
+long z(long);
+long aa(long);
+long ab(long);
+
+RET(w(0xDEAD)==1 && x(1337)==0 && y(42)==0 && z(3141) == 1 && aa(0xabc) == 1 && ab(0xdef) == 0);
diff --git a/codea/skinner33_01.instr b/codea/skinner33_01.instr
new file mode 100644 (file)
index 0000000..48082f7
--- /dev/null
@@ -0,0 +1 @@
+12
diff --git a/codea/skinner33_02.0 b/codea/skinner33_02.0
new file mode 100644 (file)
index 0000000..03a1db6
--- /dev/null
@@ -0,0 +1,11 @@
+method w(a)
+       return not a;
+end;
+
+method x(a)
+       return not (not a);
+end;
+
+method y(a)
+       return not (not (not a));
+end;
diff --git a/codea/skinner33_02.call b/codea/skinner33_02.call
new file mode 100644 (file)
index 0000000..0af1b55
--- /dev/null
@@ -0,0 +1,5 @@
+long w(long,long);
+long x(long,long);
+long y(long,long);
+
+RET(w(6,6)==0 && x(4,4)==1 && y(8,8)==0 && w(5,5) == 0 && x(3,3) == 1 && y(7,7) == 0 && w(0,0) == 1 && x(0,0) == 0 && y(0,0) == 1);
diff --git a/codea/skinner33_02.instr b/codea/skinner33_02.instr
new file mode 100644 (file)
index 0000000..7facc89
--- /dev/null
@@ -0,0 +1 @@
+36
diff --git a/codea/skinner33_03.0 b/codea/skinner33_03.0
new file mode 100644 (file)
index 0000000..126a981
--- /dev/null
@@ -0,0 +1,13 @@
+struct a b c end;
+
+method try0()
+       return (0x000FFFFB - -5).c;
+end;
+
+method try1()
+       return (0x00FFFFFD - -3).c;
+end;
+
+method try2()
+       return (0x9FFFFFFB - -5).c;
+end;
diff --git a/codea/skinner33_03.call b/codea/skinner33_03.call
new file mode 100644 (file)
index 0000000..60973c5
--- /dev/null
@@ -0,0 +1,48 @@
+#define TRIES 3
+
+/* ugly. copied from 'bits/mman.h' */
+#define PROT_READ      0x1
+#define PROT_WRITE     0x2
+#define MAP_PRIVATE    0x02
+#define MAP_FIXED      0x10
+#define MAP_ANONYMOUS  0x20
+
+void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
+
+long try0(long);
+long try1(long);
+long try2(long);
+
+/* try these adresses until one is free */
+long *tries[TRIES] = {
+       (long *)0x00100000,
+       (long *)0x01000000,
+       (long *)0xA0000000
+};
+
+int   t    = 0;
+long *addr = NULL;
+
+for (t = 0; t < TRIES; t++) {
+       addr = mmap(tries[t], 4096, PROT_READ | PROT_WRITE,
+                   MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
+
+       if (tries[t] == addr)
+               break;
+}
+
+if ((void *)-1 == addr) {
+       puts("unable to map memory");
+       RET(1); /* keep the statistic clean */
+}
+
+addr[2] = 1337;
+
+printf("try %d\n", t);
+
+switch (t) {
+case 0:        RET(try0(0xcafebabe) == 1337);
+case 1:        RET(try1(0xcafebabe) == 1337);
+case 2:        RET(try2(0xcafebabe) == 1337);
+}
+
diff --git a/codea/skinner33_03.instr b/codea/skinner33_03.instr
new file mode 100644 (file)
index 0000000..0cfbf08
--- /dev/null
@@ -0,0 +1 @@
+2
index 48082f72f087ce7e6fa75b9c41d7387daecd447b..59343b09ec765366a5b0ac04196385079acd864e 100644 (file)
@@ -1 +1 @@
-12
+53