2009-06-24 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / tests / make_imt_test.sh
blob3cc1c8721863e51eecd869597c82b755be965c7e
1 #!/usr/bin/env bash
3 LOW=2000
4 HIGH=2000
6 function create_iface () {
7 COUNT=$1
8 echo "public interface Iface_$COUNT {"
9 for i in `seq 1 $COUNT`;
11 echo " int Method_$i (int a, int b, int c, int d);"
12 done
13 echo "}"
14 echo
18 function create_impl () {
19 COUNT=$1
20 echo "public class Impl_$COUNT : Iface_$COUNT {"
21 for i in `seq 1 $COUNT`;
23 echo " public virtual int Method_$i (int a, int b, int c, int d) { return a - b - c - d + ${i}; }"
24 done
25 echo "}"
26 echo
30 function create_static_part () {
31 IFACE=$1
32 echo " static Iface_$IFACE var_$IFACE = new Impl_$IFACE ();"
33 echo " static int Test_$IFACE () {
34 int res = 0;
35 int r;
38 for i in `seq 1 $IFACE`;
39 do
40 echo " if ((r = var_${IFACE}.Method_$i (10,5,3,2)) != ${i}) {
41 Console.WriteLine(\"iface $IFACE method $i returned {0}\", r);
42 res = 1;
45 done
47 echo " return res;
52 function test_iface () {
53 IFACE=$1
54 echo " res |= Test_$IFACE ();"
58 ####Part that split the output
60 echo "using System;
64 for i in `seq $LOW $HIGH`;
66 create_iface $i
67 create_impl $i
68 done
72 echo "
73 public class Driver
78 for i in `seq $LOW $HIGH`;
80 create_static_part $i
81 done
84 echo "
85 public static int Main ()
87 int res = 0;"
90 for i in `seq $LOW $HIGH`;
92 test_iface $i
93 done
96 echo " return res;