static void RunTest6(string report) { Console.WriteLine(report); C_INTArray_Exp retval1 = S_INTArray_Ret2(); Assert.IsTrue(Equals(InitArray <int>(ARRAY_SIZE), retval1.arr)); C_UINTArray_Exp retval2 = S_UINTArray_Ret2(); Assert.IsTrue(Equals(InitArray <uint>(ARRAY_SIZE), retval2.arr)); C_SHORTArray_Exp retval3 = S_SHORTArray_Ret2(); Assert.IsTrue(Equals(InitArray <short>(ARRAY_SIZE), retval3.arr)); C_WORDArray_Exp retval4 = S_WORDArray_Ret2(); Assert.IsTrue(Equals(InitArray <ushort>(ARRAY_SIZE), retval4.arr)); C_LONG64Array_Exp retval5 = S_LONG64Array_Ret2(); Assert.IsTrue(Equals(InitArray <long>(ARRAY_SIZE), retval5.arr)); C_ULONG64Array_Exp retval6 = S_ULONG64Array_Ret2(); Assert.IsTrue(Equals(InitArray <ulong>(ARRAY_SIZE), retval6.arr)); C_DOUBLEArray_Exp retval7 = S_DOUBLEArray_Ret2(); Assert.IsTrue(Equals(InitArray <double>(ARRAY_SIZE), retval7.arr)); C_FLOATArray_Exp retval8 = S_FLOATArray_Ret2(); Assert.IsTrue(Equals(InitArray <float>(ARRAY_SIZE), retval8.arr)); C_BYTEArray_Exp retval9 = S_BYTEArray_Ret2(); Assert.IsTrue(Equals(InitArray <byte>(ARRAY_SIZE), retval9.arr)); C_CHARArray_Exp retval10 = S_CHARArray_Ret2(); Assert.IsTrue(Equals(InitArray <char>(ARRAY_SIZE), retval10.arr)); C_LPSTRArray_Exp retval11 = S_LPSTRArray_Ret2(); Assert.IsTrue(Equals(InitArray <string>(ARRAY_SIZE), retval11.arr)); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { C_BSTRArray_Exp retval12 = S_BSTRArray_Ret2(); Assert.IsTrue(Equals(InitArray <string>(ARRAY_SIZE), retval12.arr)); } C_StructArray_Exp retval13 = S_StructArray_Ret2(); Assert.IsTrue(TestStructEquals(InitStructArray(ARRAY_SIZE), retval13.arr)); }
static extern bool TakeBSTRArrayExpClassByVal([In] C_BSTRArray_Exp s, int size);
static void RunTest4(string report) { Console.WriteLine(report); C_INTArray_Exp c1 = new C_INTArray_Exp(); c1.arr = InitArray <int>(ARRAY_SIZE); Assert.IsTrue(TakeIntArrayExpClassByVal(c1, c1.arr.Length)); C_UINTArray_Exp c2 = new C_UINTArray_Exp(); c2.arr = InitArray <uint>(ARRAY_SIZE); Assert.IsTrue(TakeUIntArrayExpClassByVal(c2, c2.arr.Length)); C_SHORTArray_Exp c3 = new C_SHORTArray_Exp(); c3.arr = InitArray <short>(ARRAY_SIZE); Assert.IsTrue(TakeShortArrayExpClassByVal(c3, c3.arr.Length)); C_WORDArray_Exp c4 = new C_WORDArray_Exp(); c4.arr = InitArray <ushort>(ARRAY_SIZE); Assert.IsTrue(TakeWordArrayExpClassByVal(c4, c4.arr.Length)); C_LONG64Array_Exp c5 = new C_LONG64Array_Exp(); c5.arr = InitArray <long>(ARRAY_SIZE); Assert.IsTrue(TakeLong64ArrayExpClassByVal(c5, c5.arr.Length)); C_ULONG64Array_Exp c6 = new C_ULONG64Array_Exp(); c6.arr = InitArray <ulong>(ARRAY_SIZE); Assert.IsTrue(TakeULong64ArrayExpClassByVal(c6, c6.arr.Length)); C_DOUBLEArray_Exp c7 = new C_DOUBLEArray_Exp(); c7.arr = InitArray <double>(ARRAY_SIZE); Assert.IsTrue(TakeDoubleArrayExpClassByVal(c7, c7.arr.Length)); C_FLOATArray_Exp c8 = new C_FLOATArray_Exp(); c8.arr = InitArray <float>(ARRAY_SIZE); Assert.IsTrue(TakeFloatArrayExpClassByVal(c8, c8.arr.Length)); C_BYTEArray_Exp c9 = new C_BYTEArray_Exp(); c9.arr = InitArray <byte>(ARRAY_SIZE); Assert.IsTrue(TakeByteArrayExpClassByVal(c9, c9.arr.Length)); C_CHARArray_Exp c10 = new C_CHARArray_Exp(); c10.arr = InitArray <char>(ARRAY_SIZE); Assert.IsTrue(TakeCharArrayExpClassByVal(c10, c10.arr.Length)); C_LPSTRArray_Exp c11 = new C_LPSTRArray_Exp(); c11.arr = InitArray <string>(ARRAY_SIZE); Assert.IsTrue(TakeLPSTRArrayExpClassByVal(c11, c11.arr.Length)); C_LPCSTRArray_Exp c12 = new C_LPCSTRArray_Exp(); c12.arr = InitArray <string>(ARRAY_SIZE); Assert.IsTrue(TakeLPCSTRArrayExpClassByVal(c12, c12.arr.Length)); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { C_BSTRArray_Exp c13 = new C_BSTRArray_Exp(); c13.arr = InitArray <string>(ARRAY_SIZE); Assert.IsTrue(TakeBSTRArrayExpClassByVal(c13, c13.arr.Length)); } C_StructArray_Exp c14 = new C_StructArray_Exp(); c14.arr = InitStructArray(ARRAY_SIZE); Assert.IsTrue(TakeStructArrayExpClassByVal(c14, c14.arr.Length)); }
static void RunTest4(string report) { Console.WriteLine(report); C_INTArray_Exp c1 = new C_INTArray_Exp(); c1.arr = InitArray <int>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeIntArrayExpClassByVal(c1, ARRAY_SIZE), "TakeIntArrayExpClassByVal"); C_UINTArray_Exp c2 = new C_UINTArray_Exp(); c2.arr = InitArray <uint>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeUIntArrayExpClassByVal(c2, ARRAY_SIZE), "TakeUIntArrayExpClassByVal"); C_SHORTArray_Exp c3 = new C_SHORTArray_Exp(); c3.arr = InitArray <short>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeShortArrayExpClassByVal(c3, ARRAY_SIZE), "TakeShortArrayExpClassByVal"); C_WORDArray_Exp c4 = new C_WORDArray_Exp(); c4.arr = InitArray <ushort>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeWordArrayExpClassByVal(c4, ARRAY_SIZE), "TakeWordArrayExpClassByVal"); C_LONG64Array_Exp c5 = new C_LONG64Array_Exp(); c5.arr = InitArray <long>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeLong64ArrayExpClassByVal(c5, ARRAY_SIZE), "TakeLong64ArrayExpClassByVal"); C_ULONG64Array_Exp c6 = new C_ULONG64Array_Exp(); c6.arr = InitArray <ulong>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeULong64ArrayExpClassByVal(c6, ARRAY_SIZE), "TakeULong64ArrayExpClassByVal"); C_DOUBLEArray_Exp c7 = new C_DOUBLEArray_Exp(); c7.arr = InitArray <double>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeDoubleArrayExpClassByVal(c7, ARRAY_SIZE), "TakeDoubleArrayExpClassByVal"); C_FLOATArray_Exp c8 = new C_FLOATArray_Exp(); c8.arr = InitArray <float>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeFloatArrayExpClassByVal(c8, ARRAY_SIZE), "TakeFloatArrayExpClassByVal"); C_BYTEArray_Exp c9 = new C_BYTEArray_Exp(); c9.arr = InitArray <byte>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeByteArrayExpClassByVal(c9, ARRAY_SIZE), "TakeByteArrayExpClassByVal"); C_CHARArray_Exp c10 = new C_CHARArray_Exp(); c10.arr = InitArray <char>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeCharArrayExpClassByVal(c10, ARRAY_SIZE), "TakeCharArrayExpClassByVal"); C_LPSTRArray_Exp c11 = new C_LPSTRArray_Exp(); c11.arr = InitArray <string>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeLPSTRArrayExpClassByVal(c11, ARRAY_SIZE), "TakeLPSTRArrayExpClassByVal"); C_LPCSTRArray_Exp c12 = new C_LPCSTRArray_Exp(); c12.arr = InitArray <string>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeLPCSTRArrayExpClassByVal(c12, ARRAY_SIZE), "TakeLPCSTRArrayExpClassByVal"); if (OperatingSystem.IsWindows()) { C_BSTRArray_Exp c13 = new C_BSTRArray_Exp(); c13.arr = InitArray <string>(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeBSTRArrayExpClassByVal(c13, ARRAY_SIZE), "TakeBSTRArrayExpClassByVal"); } C_StructArray_Exp c14 = new C_StructArray_Exp(); c14.arr = InitStructArray(ARRAY_SIZE); Assert.Throws <TypeLoadException>(() => TakeStructArrayExpClassByVal(c14, ARRAY_SIZE), "TakeStructArrayExpClassByVal"); }