From: Martin Perner Date: Sat, 15 May 2010 16:39:56 +0000 (+0200) Subject: codea: First Round of Testcases and updates X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=testub10.git;a=commitdiff_plain;h=784d0748d50df7d6c2577dd561adfd73f9120a6e codea: First Round of Testcases and updates Added 3 Testcases Changes Instr. count for 3 other testcases --- diff --git a/codea/lewurm_07.instr b/codea/lewurm_07.instr index 8f92bfd..9902f17 100644 --- a/codea/lewurm_07.instr +++ b/codea/lewurm_07.instr @@ -1 +1 @@ -35 +28 diff --git a/codea/lewurm_10.instr b/codea/lewurm_10.instr index f599e28..48082f7 100644 --- a/codea/lewurm_10.instr +++ b/codea/lewurm_10.instr @@ -1 +1 @@ -10 +12 diff --git a/codea/skinner33_00.0 b/codea/skinner33_00.0 new file mode 100644 index 0000000..b8ed559 --- /dev/null +++ b/codea/skinner33_00.0 @@ -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 index 0000000..bc046a1 --- /dev/null +++ b/codea/skinner33_00.call @@ -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 index 0000000..7facc89 --- /dev/null +++ b/codea/skinner33_00.instr @@ -0,0 +1 @@ +36 diff --git a/codea/skinner33_01.0 b/codea/skinner33_01.0 new file mode 100644 index 0000000..25fab69 --- /dev/null +++ b/codea/skinner33_01.0 @@ -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 index 0000000..af3f291 --- /dev/null +++ b/codea/skinner33_01.call @@ -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 index 0000000..48082f7 --- /dev/null +++ b/codea/skinner33_01.instr @@ -0,0 +1 @@ +12 diff --git a/codea/skinner33_02.0 b/codea/skinner33_02.0 new file mode 100644 index 0000000..03a1db6 --- /dev/null +++ b/codea/skinner33_02.0 @@ -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 index 0000000..0af1b55 --- /dev/null +++ b/codea/skinner33_02.call @@ -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 index 0000000..7facc89 --- /dev/null +++ b/codea/skinner33_02.instr @@ -0,0 +1 @@ +36 diff --git a/codea/skinner33_03.0 b/codea/skinner33_03.0 new file mode 100644 index 0000000..126a981 --- /dev/null +++ b/codea/skinner33_03.0 @@ -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 index 0000000..60973c5 --- /dev/null +++ b/codea/skinner33_03.call @@ -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 index 0000000..0cfbf08 --- /dev/null +++ b/codea/skinner33_03.instr @@ -0,0 +1 @@ +2 diff --git a/codea/snafu_03.instr b/codea/snafu_03.instr index 48082f7..59343b0 100644 --- a/codea/snafu_03.instr +++ b/codea/snafu_03.instr @@ -1 +1 @@ -12 +53