public static void virtualTest <T> (VirtualTest <T> vt, int len) { VirtualTestCaller <T> vtc = new VirtualTestCaller <T> (); T[] arr = vtc.doCall(vt); typeCheck("virtualTest", arr, typeof(T[])); if (arr.Length != len) { error("virtualTest length"); } }
public static int Main() { work <ClassA> (new ClassA(), false); work <ClassB> (new ClassB(), true); work <ClassB> (new ClassB(), true); work <ClassC> (new ClassC(), true); work <GenA <ClassA> > (new GenA <ClassA> (), true); work <int[]> (new int[3], true); work <int> (123, true); work <int?> (123, true); work <GenStruct <ClassA>?> (new GenStruct <ClassA> (123), true); work <GenStruct <ClassA>?> (null, true); StaticTest <ClassA> sa = new StaticTest <ClassA> (1234); StaticTest <ClassB> sb = new StaticTest <ClassB> (2345); if (sa.getStat() != 1234) { error("getStat"); } if (sb.getStat() != 2345) { error("getStat"); } if (sa.getOtherStat() != 0) { error("getOtherStat"); } if (sa.getGenCStat() != 1234) { error("getGenCStat A"); } if (sb.getGenCStat() != 1234) { error("getGenCStat B"); } NonGenUser <NonGen> ngu = new NonGenUser <NonGen> (); if (ngu.getNonGenField() != 123) { error("getNonGenField"); } AccessTest <ClassA> ata = new AccessTest <ClassA> (); if (ata.getOtherField() != 123) { error("getOtherField"); } VirtualTest <ClassA> vta = new VirtualTest <ClassA> (); VirtualTest <ClassB> vtb = new VirtualTestDeriv <ClassB> (); virtualTest <ClassA> (vta, 3); virtualTest <ClassB> (vtb, 4); listTest(); if (haveError) { return(1); } return(0); }
public T[] doCall(VirtualTest <T> vt) { return(vt.newArr()); }