static extern bool TakeIntArrayExpStructByVal([In] S_INTArray_Exp s, int size);
    static bool RunTest3(string report)
    {
        Console.WriteLine(report);

        S_INTArray_Exp s1 = new S_INTArray_Exp();

        s1.arr = InitArray <int>(ARRAY_SIZE);
        TestHelper.Assert(TakeIntArrayExpStructByVal(s1, s1.arr.Length), "TakeIntArrayExpStructByVal");

        S_UINTArray_Exp s2 = new S_UINTArray_Exp();

        s2.arr = InitArray <uint>(ARRAY_SIZE);
        TestHelper.Assert(TakeUIntArrayExpStructByVal(s2, s2.arr.Length), "TakeUIntArrayExpStructByVal");

        S_SHORTArray_Exp s3 = new S_SHORTArray_Exp();

        s3.arr = InitArray <short>(ARRAY_SIZE);
        TestHelper.Assert(TakeShortArrayExpStructByVal(s3, s3.arr.Length), "TakeShortArrayExpStructByVal");

        S_WORDArray_Exp s4 = new S_WORDArray_Exp();

        s4.arr = InitArray <ushort>(ARRAY_SIZE);
        TestHelper.Assert(TakeWordArrayExpStructByVal(s4, s4.arr.Length), "TakeWordArrayExpStructByVal");

        S_LONG64Array_Exp s5 = new S_LONG64Array_Exp();

        s5.arr = InitArray <long>(ARRAY_SIZE);
        TestHelper.Assert(TakeLong64ArrayExpStructByVal(s5, s5.arr.Length), "TakeLong64ArrayExpStructByVal");

        S_ULONG64Array_Exp s6 = new S_ULONG64Array_Exp();

        s6.arr = InitArray <ulong>(ARRAY_SIZE);
        TestHelper.Assert(TakeULong64ArrayExpStructByVal(s6, s6.arr.Length), "TakeULong64ArrayExpStructByVal");

        S_DOUBLEArray_Exp s7 = new S_DOUBLEArray_Exp();

        s7.arr = InitArray <double>(ARRAY_SIZE);
        TestHelper.Assert(TakeDoubleArrayExpStructByVal(s7, s7.arr.Length), "TakeDoubleArrayExpStructByVal");

        S_FLOATArray_Exp s8 = new S_FLOATArray_Exp();

        s8.arr = InitArray <float>(ARRAY_SIZE);
        TestHelper.Assert(TakeFloatArrayExpStructByVal(s8, s8.arr.Length), "TakeFloatArrayExpStructByVal");

        S_BYTEArray_Exp s9 = new S_BYTEArray_Exp();

        s9.arr = InitArray <byte>(ARRAY_SIZE);
        TestHelper.Assert(TakeByteArrayExpStructByVal(s9, s9.arr.Length), "TakeByteArrayExpStructByVal");

        S_CHARArray_Exp s10 = new S_CHARArray_Exp();

        s10.arr = InitArray <char>(ARRAY_SIZE);
        TestHelper.Assert(TakeCharArrayExpStructByVal(s10, s10.arr.Length), "TakeCharArrayExpStructByVal");

        S_LPSTRArray_Exp s11 = new S_LPSTRArray_Exp();

        s11.arr = InitArray <string>(ARRAY_SIZE);
        TestHelper.Assert(TakeLPSTRArrayExpStructByVal(s11, s11.arr.Length));

        S_LPCSTRArray_Exp s12 = new S_LPCSTRArray_Exp();

        s12.arr = InitArray <string>(ARRAY_SIZE);
        TestHelper.Assert(TakeLPCSTRArrayExpStructByVal(s12, s12.arr.Length));

#if NONWINDOWS_BUG
        S_StructArray_Exp s14 = new S_StructArray_Exp();
        s14.arr = InitStructArray(ARRAY_SIZE);
        TestHelper.Assert(TakeStructArrayExpStructByVal(s14, s14.arr.Length));
#endif

        return(true);
    }
    static void RunTest3(string report)
    {
        Console.WriteLine(report);

        S_INTArray_Exp s1 = new S_INTArray_Exp();

        s1.arr = InitArray <int>(ARRAY_SIZE);
        Assert.IsTrue(TakeIntArrayExpStructByVal(s1, s1.arr.Length), "TakeIntArrayExpStructByVal");

        S_UINTArray_Exp s2 = new S_UINTArray_Exp();

        s2.arr = InitArray <uint>(ARRAY_SIZE);
        Assert.IsTrue(TakeUIntArrayExpStructByVal(s2, s2.arr.Length), "TakeUIntArrayExpStructByVal");

        S_SHORTArray_Exp s3 = new S_SHORTArray_Exp();

        s3.arr = InitArray <short>(ARRAY_SIZE);
        Assert.IsTrue(TakeShortArrayExpStructByVal(s3, s3.arr.Length), "TakeShortArrayExpStructByVal");

        S_WORDArray_Exp s4 = new S_WORDArray_Exp();

        s4.arr = InitArray <ushort>(ARRAY_SIZE);
        Assert.IsTrue(TakeWordArrayExpStructByVal(s4, s4.arr.Length), "TakeWordArrayExpStructByVal");

        S_LONG64Array_Exp s5 = new S_LONG64Array_Exp();

        s5.arr = InitArray <long>(ARRAY_SIZE);
        Assert.IsTrue(TakeLong64ArrayExpStructByVal(s5, s5.arr.Length), "TakeLong64ArrayExpStructByVal");

        S_ULONG64Array_Exp s6 = new S_ULONG64Array_Exp();

        s6.arr = InitArray <ulong>(ARRAY_SIZE);
        Assert.IsTrue(TakeULong64ArrayExpStructByVal(s6, s6.arr.Length), "TakeULong64ArrayExpStructByVal");

        S_DOUBLEArray_Exp s7 = new S_DOUBLEArray_Exp();

        s7.arr = InitArray <double>(ARRAY_SIZE);
        Assert.IsTrue(TakeDoubleArrayExpStructByVal(s7, s7.arr.Length), "TakeDoubleArrayExpStructByVal");

        S_FLOATArray_Exp s8 = new S_FLOATArray_Exp();

        s8.arr = InitArray <float>(ARRAY_SIZE);
        Assert.IsTrue(TakeFloatArrayExpStructByVal(s8, s8.arr.Length), "TakeFloatArrayExpStructByVal");

        S_BYTEArray_Exp s9 = new S_BYTEArray_Exp();

        s9.arr = InitArray <byte>(ARRAY_SIZE);
        Assert.IsTrue(TakeByteArrayExpStructByVal(s9, s9.arr.Length), "TakeByteArrayExpStructByVal");

        S_CHARArray_Exp s10 = new S_CHARArray_Exp();

        s10.arr = InitArray <char>(ARRAY_SIZE);
        Assert.IsTrue(TakeCharArrayExpStructByVal(s10, s10.arr.Length), "TakeCharArrayExpStructByVal");

        S_LPSTRArray_Exp s11 = new S_LPSTRArray_Exp();

        s11.arr = InitArray <string>(ARRAY_SIZE);
        Assert.IsTrue(TakeLPSTRArrayExpStructByVal(s11, s11.arr.Length));

        S_LPCSTRArray_Exp s12 = new S_LPCSTRArray_Exp();

        s12.arr = InitArray <string>(ARRAY_SIZE);
        Assert.IsTrue(TakeLPCSTRArrayExpStructByVal(s12, s12.arr.Length));


        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            S_BSTRArray_Exp c13 = new S_BSTRArray_Exp();
            c13.arr = InitArray <string>(ARRAY_SIZE);
            Assert.IsTrue(TakeBSTRArrayExpStructByVal(c13, c13.arr.Length));
        }

        S_StructArray_Exp s14 = new S_StructArray_Exp();

        s14.arr = InitStructArray(ARRAY_SIZE);
        Assert.IsTrue(TakeStructArrayExpStructByVal(s14, s14.arr.Length));
    }
Exemple #4
0
    static void RunTest3(string report)
    {
        Console.WriteLine(report);

        S_INTArray_Exp s1 = new S_INTArray_Exp();

        s1.arr = InitArray <int>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeIntArrayExpStructByVal(s1, ARRAY_SIZE), "TakeIntArrayExpStructByVal");

        S_UINTArray_Exp s2 = new S_UINTArray_Exp();

        s2.arr = InitArray <uint>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeUIntArrayExpStructByVal(s2, ARRAY_SIZE), "TakeUIntArrayExpStructByVal");

        S_SHORTArray_Exp s3 = new S_SHORTArray_Exp();

        s3.arr = InitArray <short>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeShortArrayExpStructByVal(s3, ARRAY_SIZE), "TakeShortArrayExpStructByVal");

        S_WORDArray_Exp s4 = new S_WORDArray_Exp();

        s4.arr = InitArray <ushort>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeWordArrayExpStructByVal(s4, ARRAY_SIZE), "TakeWordArrayExpStructByVal");

        S_LONG64Array_Exp s5 = new S_LONG64Array_Exp();

        s5.arr = InitArray <long>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeLong64ArrayExpStructByVal(s5, ARRAY_SIZE), "TakeLong64ArrayExpStructByVal");

        S_ULONG64Array_Exp s6 = new S_ULONG64Array_Exp();

        s6.arr = InitArray <ulong>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeULong64ArrayExpStructByVal(s6, ARRAY_SIZE), "TakeULong64ArrayExpStructByVal");

        S_DOUBLEArray_Exp s7 = new S_DOUBLEArray_Exp();

        s7.arr = InitArray <double>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeDoubleArrayExpStructByVal(s7, ARRAY_SIZE), "TakeDoubleArrayExpStructByVal");

        S_FLOATArray_Exp s8 = new S_FLOATArray_Exp();

        s8.arr = InitArray <float>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeFloatArrayExpStructByVal(s8, ARRAY_SIZE), "TakeFloatArrayExpStructByVal");

        S_BYTEArray_Exp s9 = new S_BYTEArray_Exp();

        s9.arr = InitArray <byte>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeByteArrayExpStructByVal(s9, ARRAY_SIZE), "TakeByteArrayExpStructByVal");

        S_CHARArray_Exp s10 = new S_CHARArray_Exp();

        s10.arr = InitArray <char>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeCharArrayExpStructByVal(s10, ARRAY_SIZE), "TakeCharArrayExpStructByVal");

        S_LPSTRArray_Exp s11 = new S_LPSTRArray_Exp();

        s11.arr = InitArray <string>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeLPSTRArrayExpStructByVal(s11, ARRAY_SIZE), "TakeLPSTRArrayExpStructByVal");

        S_LPCSTRArray_Exp s12 = new S_LPCSTRArray_Exp();

        s12.arr = InitArray <string>(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeLPCSTRArrayExpStructByVal(s12, ARRAY_SIZE), "TakeLPCSTRArrayExpStructByVal");

        if (OperatingSystem.IsWindows())
        {
            S_BSTRArray_Exp s13 = new S_BSTRArray_Exp();
            s13.arr = InitArray <string>(ARRAY_SIZE);
            Assert.Throws <TypeLoadException>(() => TakeBSTRArrayExpStructByVal(s13, ARRAY_SIZE), "TakeBSTRArrayExpStructByVal");
        }

        S_StructArray_Exp s14 = new S_StructArray_Exp();

        s14.arr = InitStructArray(ARRAY_SIZE);
        Assert.Throws <TypeLoadException>(() => TakeStructArrayExpStructByVal(s14, ARRAY_SIZE), "TakeStructArrayExpStructByVal");
    }