Esempio n. 1
0
    static void RunTest1(string report)
    {
        Console.WriteLine(report);

        S_INTArray_Seq s1 = new S_INTArray_Seq();

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

        S_UINTArray_Seq s2 = new S_UINTArray_Seq();

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

        S_SHORTArray_Seq s3 = new S_SHORTArray_Seq();

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

        S_WORDArray_Seq s4 = new S_WORDArray_Seq();

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

        S_LONG64Array_Seq s5 = new S_LONG64Array_Seq();

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

        S_ULONG64Array_Seq s6 = new S_ULONG64Array_Seq();

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

        S_DOUBLEArray_Seq s7 = new S_DOUBLEArray_Seq();

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

        S_FLOATArray_Seq s8 = new S_FLOATArray_Seq();

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

        S_BYTEArray_Seq s9 = new S_BYTEArray_Seq();

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

        S_CHARArray_Seq s10 = new S_CHARArray_Seq();

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

        S_LPSTRArray_Seq s11 = new S_LPSTRArray_Seq();

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

        S_LPCSTRArray_Seq s12 = new S_LPCSTRArray_Seq();

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

        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            S_BSTRArray_Seq s13 = new S_BSTRArray_Seq();
            s13.arr = InitArray <string>(ARRAY_SIZE);
            Assert.IsTrue(TakeBSTRArraySeqStructByVal(s13, s13.arr.Length), "TakeBSTRArraySeqStructByVal");
        }

        S_StructArray_Seq s14 = new S_StructArray_Seq();

        s14.arr = InitStructArray(ARRAY_SIZE);
        Assert.IsTrue(TakeStructArraySeqStructByVal(s14, s14.arr.Length), "TakeStructArraySeqStructByVal");
    }
Esempio n. 2
0
 static extern bool TakeIntArraySeqStructByVal([In] S_INTArray_Seq s, int size);
Esempio n. 3
0
    static void RunTest1(string report)
    {
        Console.WriteLine(report);

        S_INTArray_Seq s1 = new S_INTArray_Seq();

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

        S_UINTArray_Seq s2 = new S_UINTArray_Seq();

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

        S_SHORTArray_Seq s3 = new S_SHORTArray_Seq();

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

        S_WORDArray_Seq s4 = new S_WORDArray_Seq();

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

        S_LONG64Array_Seq s5 = new S_LONG64Array_Seq();

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

        S_ULONG64Array_Seq s6 = new S_ULONG64Array_Seq();

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

        S_DOUBLEArray_Seq s7 = new S_DOUBLEArray_Seq();

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

        S_FLOATArray_Seq s8 = new S_FLOATArray_Seq();

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

        S_BYTEArray_Seq s9 = new S_BYTEArray_Seq();

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

        S_CHARArray_Seq s10 = new S_CHARArray_Seq();

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

        S_LPSTRArray_Seq s11 = new S_LPSTRArray_Seq();

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

        S_LPCSTRArray_Seq s12 = new S_LPCSTRArray_Seq();

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

        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            S_BSTRArray_Seq s13 = new S_BSTRArray_Seq();
            s13.arr = InitArray <string>(ARRAY_SIZE);
            Assert.IsTrue(TakeBSTRArraySeqStructByVal(s13, s13.arr.Length), "TakeBSTRArraySeqStructByVal");
        }

        S_StructArray_Seq s14 = new S_StructArray_Seq();

        s14.arr = InitStructArray(ARRAY_SIZE);
        Assert.IsTrue(TakeStructArraySeqStructByVal(s14, s14.arr.Length), "TakeStructArraySeqStructByVal");

        EnregisterableNonBlittable_Seq s15 = new EnregisterableNonBlittable_Seq
        {
            arr = new TestEnum[3]
            {
                TestEnum.Red,
                TestEnum.Green,
                TestEnum.Blue
            }
        };

        Assert.IsTrue(TakeEnregistrableNonBlittableSeqStructByVal(s15, s15.arr), "EnregisterableNonBlittableSeqStructByVal");

        EnregisterableUserType s16 = new EnregisterableUserType
        {
            arr = new SimpleStruct[3]
            {
                new SimpleStruct {
                    fld = 10
                },
                new SimpleStruct {
                    fld = 25
                },
                new SimpleStruct {
                    fld = 40
                }
            }
        };

        Assert.IsTrue(TakeEnregisterableUserTypeStructByVal(s16, s16.arr), "TakeEnregisterableUserTypeStructByVal");
    }
Esempio n. 4
0
    static void RunTest5(string report)
    {
        Console.WriteLine(report);

        S_INTArray_Seq retval = S_INTArray_Ret_ByValue();

        Assert.IsTrue(Equals(InitArray <int>(ARRAY_SIZE), retval.arr));

        C_INTArray_Seq retval1 = S_INTArray_Ret();

        Assert.IsTrue(Equals(InitArray <int>(ARRAY_SIZE), retval1.arr));

        C_UINTArray_Seq retval2 = S_UINTArray_Ret();

        Assert.IsTrue(Equals(InitArray <uint>(ARRAY_SIZE), retval2.arr));

        C_SHORTArray_Seq retval3 = S_SHORTArray_Ret();

        Assert.IsTrue(Equals(InitArray <short>(ARRAY_SIZE), retval3.arr));

        C_WORDArray_Seq retval4 = S_WORDArray_Ret();

        Assert.IsTrue(Equals(InitArray <ushort>(ARRAY_SIZE), retval4.arr));

        C_LONG64Array_Seq retval5 = S_LONG64Array_Ret();

        Assert.IsTrue(Equals(InitArray <long>(ARRAY_SIZE), retval5.arr));

        C_ULONG64Array_Seq retval6 = S_ULONG64Array_Ret();

        Assert.IsTrue(Equals(InitArray <ulong>(ARRAY_SIZE), retval6.arr));

        C_DOUBLEArray_Seq retval7 = S_DOUBLEArray_Ret();

        Assert.IsTrue(Equals(InitArray <double>(ARRAY_SIZE), retval7.arr));

        C_FLOATArray_Seq retval8 = S_FLOATArray_Ret();

        Assert.IsTrue(Equals(InitArray <float>(ARRAY_SIZE), retval8.arr));

        C_BYTEArray_Seq retval9 = S_BYTEArray_Ret();

        Assert.IsTrue(Equals(InitArray <byte>(ARRAY_SIZE), retval9.arr));

        C_CHARArray_Seq retval10 = S_CHARArray_Ret();

        Assert.IsTrue(Equals(InitArray <char>(ARRAY_SIZE), retval10.arr));

        C_LPSTRArray_Seq retval11 = S_LPSTRArray_Ret();

        Assert.IsTrue(Equals(InitArray <string>(ARRAY_SIZE), retval11.arr));

        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            C_BSTRArray_Seq retval12 = S_BSTRArray_Ret();
            Assert.IsTrue(Equals(InitArray <string>(ARRAY_SIZE), retval12.arr));
        }

        C_StructArray_Seq retval13 = S_StructArray_Ret();

        Assert.IsTrue(TestStructEquals(InitStructArray(ARRAY_SIZE), retval13.arr));
    }
    static bool RunTest1(string report)
    {
        Console.WriteLine(report);

        S_INTArray_Seq s1 = new S_INTArray_Seq();

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

        S_UINTArray_Seq s2 = new S_UINTArray_Seq();

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

        S_SHORTArray_Seq s3 = new S_SHORTArray_Seq();

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

        S_WORDArray_Seq s4 = new S_WORDArray_Seq();

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

        S_LONG64Array_Seq s5 = new S_LONG64Array_Seq();

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

        S_ULONG64Array_Seq s6 = new S_ULONG64Array_Seq();

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

        S_DOUBLEArray_Seq s7 = new S_DOUBLEArray_Seq();

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

        S_FLOATArray_Seq s8 = new S_FLOATArray_Seq();

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

        S_BYTEArray_Seq s9 = new S_BYTEArray_Seq();

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

        S_CHARArray_Seq s10 = new S_CHARArray_Seq();

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

        S_INTPTRArray_Seq s11 = new S_INTPTRArray_Seq();

        s11.arr = InitIntPtrArray(ARRAY_SIZE);
        TestHelper.Assert(TakeIntPtrArraySeqStructByVal(s11, s11.arr.Length), "TakeIntPtrArraySeqStructByVal");

#if NONWINDOWS_BUG
        S_StructArray_Seq s14 = new S_StructArray_Seq();
        s14.arr = InitStructArray(ARRAY_SIZE);
        TestHelper.Assert(TakeStructArraySeqStructByVal(s14, s14.arr.Length), "TakeStructArraySeqStructByVal");
#endif
        return(true);
    }
Esempio n. 6
0
    static void RunTest1(string report)
    {
        Console.WriteLine(report);
        S_INTArray_Seq s1 = new S_INTArray_Seq();

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

        S_UINTArray_Seq s2 = new S_UINTArray_Seq();

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

        S_SHORTArray_Seq s3 = new S_SHORTArray_Seq();

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

        S_WORDArray_Seq s4 = new S_WORDArray_Seq();

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

        S_LONG64Array_Seq s5 = new S_LONG64Array_Seq();

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

        S_ULONG64Array_Seq s6 = new S_ULONG64Array_Seq();

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

        S_DOUBLEArray_Seq s7 = new S_DOUBLEArray_Seq();

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

        S_FLOATArray_Seq s8 = new S_FLOATArray_Seq();

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

        S_BYTEArray_Seq s9 = new S_BYTEArray_Seq();

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

        S_CHARArray_Seq s10 = new S_CHARArray_Seq();

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

        S_LPSTRArray_Seq s11 = new S_LPSTRArray_Seq();

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

        S_LPCSTRArray_Seq s12 = new S_LPCSTRArray_Seq();

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

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

        S_StructArray_Seq s14 = new S_StructArray_Seq();

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