Exemplo 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");
    }
Exemplo n.º 2
0
 static extern bool TakeFloatArraySeqStructByVal([In] S_FLOATArray_Seq s, int size);
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
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");
    }
Exemplo n.º 5
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");
    }