[gesamt] Added and adopted Testcases from SS09
authorMartin Perner <martin@perner.cc>
Wed, 9 Jun 2010 16:09:20 +0000 (18:09 +0200)
committerMartin Perner <martin@perner.cc>
Wed, 9 Jun 2010 16:09:20 +0000 (18:09 +0200)
21 files changed:
gesamt/old_abgabe_ca.0 [new file with mode: 0644]
gesamt/old_abgabe_ca.call [new file with mode: 0644]
gesamt/old_abgabe_ca.instr [new file with mode: 0644]
gesamt/old_abgabe_cb.0 [new file with mode: 0644]
gesamt/old_abgabe_cb.call [new file with mode: 0644]
gesamt/old_abgabe_cb.instr [new file with mode: 0644]
gesamt/old_abgabe_cc.0 [new file with mode: 0644]
gesamt/old_abgabe_cc.call [new file with mode: 0644]
gesamt/old_abgabe_cc.instr [new file with mode: 0644]
gesamt/old_abgabe_ce.0 [new file with mode: 0644]
gesamt/old_abgabe_ce.call [new file with mode: 0644]
gesamt/old_abgabe_ce.instr [new file with mode: 0644]
gesamt/old_abgabe_cf.0 [new file with mode: 0644]
gesamt/old_abgabe_cf.call [new file with mode: 0644]
gesamt/old_abgabe_cf.instr [new file with mode: 0644]
gesamt/old_abgabe_ch.0 [new file with mode: 0644]
gesamt/old_abgabe_ch.call [new file with mode: 0644]
gesamt/old_abgabe_ch.instr [new file with mode: 0644]
gesamt/old_abgabe_ci.0 [new file with mode: 0644]
gesamt/old_abgabe_ci.call [new file with mode: 0644]
gesamt/old_abgabe_ci.instr [new file with mode: 0644]

diff --git a/gesamt/old_abgabe_ca.0 b/gesamt/old_abgabe_ca.0
new file mode 100644 (file)
index 0000000..0e08ee1
--- /dev/null
@@ -0,0 +1,3 @@
+method f()
+  return labs(); /* aus der C-Library, erster parameter ist this!*/
+end;
diff --git a/gesamt/old_abgabe_ca.call b/gesamt/old_abgabe_ca.call
new file mode 100644 (file)
index 0000000..8027d7c
--- /dev/null
@@ -0,0 +1,2 @@
+extern long f(long);
+RET(f(5)==5 && f(-3)==3);
diff --git a/gesamt/old_abgabe_ca.instr b/gesamt/old_abgabe_ca.instr
new file mode 100644 (file)
index 0000000..00750ed
--- /dev/null
@@ -0,0 +1 @@
+3
diff --git a/gesamt/old_abgabe_cb.0 b/gesamt/old_abgabe_cb.0
new file mode 100644 (file)
index 0000000..0e0659b
--- /dev/null
@@ -0,0 +1,11 @@
+method f(x y)
+  return mymin(y,x);
+end;
+
+method mymin(x y)
+ if y<x then
+   return y;
+ else
+   return x;
+ end;
+end;
diff --git a/gesamt/old_abgabe_cb.call b/gesamt/old_abgabe_cb.call
new file mode 100644 (file)
index 0000000..668c074
--- /dev/null
@@ -0,0 +1,3 @@
+extern long f(long,long,long);
+
+RET(f(42,5,3)==3 && f(42,-3,5)==-3);
diff --git a/gesamt/old_abgabe_cb.instr b/gesamt/old_abgabe_cb.instr
new file mode 100644 (file)
index 0000000..6f4247a
--- /dev/null
@@ -0,0 +1 @@
+26
diff --git a/gesamt/old_abgabe_cc.0 b/gesamt/old_abgabe_cc.0
new file mode 100644 (file)
index 0000000..19f9094
--- /dev/null
@@ -0,0 +1,13 @@
+method f(x)
+  return (x-1).g(this-(-1));
+end;
+/*
+#C-Funktion:
+#long g(long x, long y)
+#{
+#  return h(x*2, y*3)+1;
+#}
+*/
+method h(x)
+  return x*this;
+end;
diff --git a/gesamt/old_abgabe_cc.call b/gesamt/old_abgabe_cc.call
new file mode 100644 (file)
index 0000000..90335b1
--- /dev/null
@@ -0,0 +1,10 @@
+#define DEFINE_G
+
+extern long f(long,long);
+
+
+printf("f(%d,%d) == %d, sollte %d\n",5,3,f(5,3),73);
+
+RET(f(5,3)==73);
+
+
diff --git a/gesamt/old_abgabe_cc.instr b/gesamt/old_abgabe_cc.instr
new file mode 100644 (file)
index 0000000..6f4247a
--- /dev/null
@@ -0,0 +1 @@
+26
diff --git a/gesamt/old_abgabe_ce.0 b/gesamt/old_abgabe_ce.0
new file mode 100644 (file)
index 0000000..732b552
--- /dev/null
@@ -0,0 +1,7 @@
+method fib(n)
+if 1<n then
+  return fib(n-2)-(-1*fib(n-1));
+else
+  return n;
+end;
+end;
diff --git a/gesamt/old_abgabe_ce.call b/gesamt/old_abgabe_ce.call
new file mode 100644 (file)
index 0000000..f9e8921
--- /dev/null
@@ -0,0 +1,2 @@
+extern long fib(long,long);
+RET(2==fib(42,3));
diff --git a/gesamt/old_abgabe_ce.instr b/gesamt/old_abgabe_ce.instr
new file mode 100644 (file)
index 0000000..69a893a
--- /dev/null
@@ -0,0 +1 @@
+66
diff --git a/gesamt/old_abgabe_cf.0 b/gesamt/old_abgabe_cf.0
new file mode 100644 (file)
index 0000000..5404a09
--- /dev/null
@@ -0,0 +1,15 @@
+method a(m n)
+  if m=0 then
+    return n-(-1);
+  else
+       if (0<m) then
+               if (n=0) then
+                   return a(m-1,1);
+               else
+               return a(m-1,a(m,n-1));
+               end;
+       else
+               return a(m-1,a(m,n-1));
+       end;            
+  end;
+end;
diff --git a/gesamt/old_abgabe_cf.call b/gesamt/old_abgabe_cf.call
new file mode 100644 (file)
index 0000000..f2d1304
--- /dev/null
@@ -0,0 +1,2 @@
+extern long a(long,long,long);
+RET(3==a(42,1,1));
diff --git a/gesamt/old_abgabe_cf.instr b/gesamt/old_abgabe_cf.instr
new file mode 100644 (file)
index 0000000..fb1e7bc
--- /dev/null
@@ -0,0 +1 @@
+54
diff --git a/gesamt/old_abgabe_ch.0 b/gesamt/old_abgabe_ch.0
new file mode 100644 (file)
index 0000000..17b35f3
--- /dev/null
@@ -0,0 +1,10 @@
+method tarai(x y z)
+  if y<x then
+    return tarai(
+      tarai(x-1,y,z),
+      tarai(y-1,z,x),
+      tarai(z-1,x,y));
+  else
+    return y;
+  end;
+end;
diff --git a/gesamt/old_abgabe_ch.call b/gesamt/old_abgabe_ch.call
new file mode 100644 (file)
index 0000000..485434b
--- /dev/null
@@ -0,0 +1,2 @@
+extern long tarai(long,long,long,long);
+RET(3 == tarai(42,2,1,3));
diff --git a/gesamt/old_abgabe_ch.instr b/gesamt/old_abgabe_ch.instr
new file mode 100644 (file)
index 0000000..dd47563
--- /dev/null
@@ -0,0 +1 @@
+76
diff --git a/gesamt/old_abgabe_ci.0 b/gesamt/old_abgabe_ci.0
new file mode 100644 (file)
index 0000000..f12a924
--- /dev/null
@@ -0,0 +1,9 @@
+method fib(n)
+  if 1<n then
+    var f1 := fib(n-1);
+    var f2 := fib(n-2);
+    return f1-(-1*f2);
+  else
+    return n;
+  end;
+end;
diff --git a/gesamt/old_abgabe_ci.call b/gesamt/old_abgabe_ci.call
new file mode 100644 (file)
index 0000000..f9e8921
--- /dev/null
@@ -0,0 +1,2 @@
+extern long fib(long,long);
+RET(2==fib(42,3));
diff --git a/gesamt/old_abgabe_ci.instr b/gesamt/old_abgabe_ci.instr
new file mode 100644 (file)
index 0000000..69a893a
--- /dev/null
@@ -0,0 +1 @@
+66