From 89b2d6e5e8c24415bcd51a6b3a5687880e86d164 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Tue, 8 Jun 2010 00:03:30 +0200 Subject: [PATCH] gesamt: testfaelle fix (bitte hinweis in README lesen) und ein neuer testfall --- README.markdown | 12 ++++++++++++ gesamt/lewurm_00.call | 2 -- gesamt/lewurm_00.instr | 2 +- gesamt/lewurm_01.call | 1 - gesamt/lewurm_01.instr | 2 +- gesamt/lewurm_02.call | 1 - gesamt/lewurm_02.instr | 2 +- gesamt/lewurm_03.call | 1 - gesamt/lewurm_03.instr | 2 +- gesamt/lewurm_04.call | 1 - gesamt/lewurm_04.instr | 2 +- gesamt/lewurm_06.call | 1 - gesamt/lewurm_06.instr | 2 +- gesamt/lewurm_09.0 | 20 ++++++++++++++++++++ gesamt/lewurm_09.call | 20 ++++++++++++++++++++ gesamt/lewurm_09.instr | 1 + 16 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 gesamt/lewurm_09.0 create mode 100644 gesamt/lewurm_09.call create mode 100644 gesamt/lewurm_09.instr diff --git a/README.markdown b/README.markdown index 9fd3be3..5063ebe 100644 --- a/README.markdown +++ b/README.markdown @@ -41,6 +41,18 @@ erwartete Ausgabe fuer die Datei bar.0 nennen Sie bar.out. * Jeder Testfall hat als Praefix "_", sodass keine Namenskonflikte entstehen. * Ab codea sollte auch fuer jeden erfolgreichen Testfall eine .instr Datei angelegt werden die einen Referenzwert der Instruktionen enthaelt. +### Hinweis fuer *gesamt* und `bench.sh` + +In der Call-Datei bitte **nur** Funktionen deklarieren die tatsaechlich in der +Call-Datei selbst aufgerufen werden. Beispiel: + method f() + return g(); + end; + method g() + return 123; + end; +so muss in der Call-Datei nur `f()` deklariert werden. + # Wie kannst du beitragen? diff --git a/gesamt/lewurm_00.call b/gesamt/lewurm_00.call index ab3151c..e5ebb88 100644 --- a/gesamt/lewurm_00.call +++ b/gesamt/lewurm_00.call @@ -1,4 +1,2 @@ long f(long); -long g(long); - RET(f(0xdead) == 4); diff --git a/gesamt/lewurm_00.instr b/gesamt/lewurm_00.instr index b1bd38b..b4de394 100644 --- a/gesamt/lewurm_00.instr +++ b/gesamt/lewurm_00.instr @@ -1 +1 @@ -13 +11 diff --git a/gesamt/lewurm_01.call b/gesamt/lewurm_01.call index 1338646..f0d92ca 100644 --- a/gesamt/lewurm_01.call +++ b/gesamt/lewurm_01.call @@ -1,5 +1,4 @@ long f(long,long); -long g(long,long); #define ERG 320 int ret = f(100,4); printf("ret ist %i (sollte %i sein)\n", ret, ERG); diff --git a/gesamt/lewurm_01.instr b/gesamt/lewurm_01.instr index 7273c0f..d6b2404 100644 --- a/gesamt/lewurm_01.instr +++ b/gesamt/lewurm_01.instr @@ -1 +1 @@ -25 +19 diff --git a/gesamt/lewurm_02.call b/gesamt/lewurm_02.call index cac8445..fdc828b 100644 --- a/gesamt/lewurm_02.call +++ b/gesamt/lewurm_02.call @@ -1,5 +1,4 @@ long f(long,long); -long g(long,long); #define ERG 200 int ret = f(0xdead,50); printf("ret ist %i (sollte %i sein)\n", ret, ERG); diff --git a/gesamt/lewurm_02.instr b/gesamt/lewurm_02.instr index 425151f..e85087a 100644 --- a/gesamt/lewurm_02.instr +++ b/gesamt/lewurm_02.instr @@ -1 +1 @@ -40 +31 diff --git a/gesamt/lewurm_03.call b/gesamt/lewurm_03.call index 89df9ac..bfcd116 100644 --- a/gesamt/lewurm_03.call +++ b/gesamt/lewurm_03.call @@ -1,5 +1,4 @@ long f(long); -long g(long); #define ERG 320 int ret = f(ERG); printf("ret ist %i (sollte %i sein)\n", ret, ERG); diff --git a/gesamt/lewurm_03.instr b/gesamt/lewurm_03.instr index 60d3b2f..48082f7 100644 --- a/gesamt/lewurm_03.instr +++ b/gesamt/lewurm_03.instr @@ -1 +1 @@ -15 +12 diff --git a/gesamt/lewurm_04.call b/gesamt/lewurm_04.call index cfed53a..ef1c964 100644 --- a/gesamt/lewurm_04.call +++ b/gesamt/lewurm_04.call @@ -1,5 +1,4 @@ long f(long); -long g(long); #define ERG(a) ((a-1)-(a-2)-a) int ret1 = f(-10); int ret2 = f(1337); diff --git a/gesamt/lewurm_04.instr b/gesamt/lewurm_04.instr index 52bd8e4..f96ac06 100644 --- a/gesamt/lewurm_04.instr +++ b/gesamt/lewurm_04.instr @@ -1 +1 @@ -120 +105 diff --git a/gesamt/lewurm_06.call b/gesamt/lewurm_06.call index e65a81c..8a0a9f5 100644 --- a/gesamt/lewurm_06.call +++ b/gesamt/lewurm_06.call @@ -1,5 +1,4 @@ long f(long); -long g(long, long, long); #define ERG(a) ((a-1)-(a-5)-(a-10)) #define ARG1 -10 #define ARG2 1333157 diff --git a/gesamt/lewurm_06.instr b/gesamt/lewurm_06.instr index d88e313..b5489e5 100644 --- a/gesamt/lewurm_06.instr +++ b/gesamt/lewurm_06.instr @@ -1 +1 @@ -81 +69 diff --git a/gesamt/lewurm_09.0 b/gesamt/lewurm_09.0 new file mode 100644 index 0000000..58e31db --- /dev/null +++ b/gesamt/lewurm_09.0 @@ -0,0 +1,20 @@ +/* inspired by s'evil skinn0rEE ! */ +struct a end; +method f() + return ((this--8).g()).h(j()); +end; + +method g() + this.a := this.a*10; + return this--8; +end; + +method h() + this.a := this.a*20; + return this--8; +end; + +method j() + this.a := this.a*30; + return this--8; +end; diff --git a/gesamt/lewurm_09.call b/gesamt/lewurm_09.call new file mode 100644 index 0000000..80343ce --- /dev/null +++ b/gesamt/lewurm_09.call @@ -0,0 +1,20 @@ +unsigned long long f(unsigned long long[]); + +/* hint: pointer arithmetic in C */ +#define ERG (ar + 3) + +unsigned long long ar[] = {5, 6, 7}; +unsigned long long ar_copy[] = {5, 6, 7}; +int j; +unsigned long long ret; + +printf("adr of ar: 0x%016lx\n", ar); +for(j=0; j < sizeof ar / sizeof ar[0]; j++) { + printf("ar[%i]: %d\n", j, ar[j]); +} +ret = f(ar); +printf("ret ist 0x%016lx (sollte 0x%016lx sein)\n", ret, ERG); +for(j=0; j < sizeof ar / sizeof ar[0]; j++) { + printf("ar[%i]: %d\n", j, ar[j]); +} +RET(ret == (unsigned long long) ERG && ar[0] == ar_copy[0] * 30 && ar[1] == ar_copy[1] * 10 && ar[2] == ar_copy[2] * 20); diff --git a/gesamt/lewurm_09.instr b/gesamt/lewurm_09.instr new file mode 100644 index 0000000..8f92bfd --- /dev/null +++ b/gesamt/lewurm_09.instr @@ -0,0 +1 @@ +35 -- 2.25.1