Esempio n. 1
0
    public static InlineArray2 Get()
    {
        var val = new InlineArray2();

        for (int i = 0; i < 4; i++)
        {
            val.Array[i] = (float)(i + 1);
        }

        return(val);
    }
Esempio n. 2
0
    public bool Equals(InlineArray2 other)
    {
        fixed(float *arr = Array)
        {
            for (int i = 0; i < 4; i++)
            {
                if (arr[i] != other.Array[i])
                {
                    return(false);
                }
            }
        }

        return(true);
    }
Esempio n. 3
0
	static extern InlineArray2 EchoInlineArray2(InlineArray2 value);
Esempio n. 4
0
	public bool Equals(InlineArray2 other)
	{
		fixed (float* arr = Array)
		{
			for (int i = 0; i < 4; i++)
			{
				if (arr[i] != other.Array[i])
				{
					return false;
				}
			}
		}

		return true;
	}
Esempio n. 5
0
	public static InlineArray2 Get()
	{
		var val = new InlineArray2();
		for (int i = 0; i < 4; i++)
		{
			val.Array[i] = (float)(i + 1);
		}

		return val;
	}
Esempio n. 6
0
    static int Main()
    {
        var        ok = true;
        SingleByte expectedSingleByte = SingleByte.Get();
        SingleByte actualSingleByte   = EchoSingleByte(expectedSingleByte);

        if (!expectedSingleByte.Equals(actualSingleByte))
        {
            Console.WriteLine("EchoSingleByte failed");
            ok = false;
        }

        SingleLong expectedSingleLong = SingleLong.Get();
        SingleLong actualSingleLong   = EchoSingleLong(expectedSingleLong);

        if (!expectedSingleLong.Equals(actualSingleLong))
        {
            Console.WriteLine("EchoSingleLong failed");
            ok = false;
        }

        SingleFloat expectedSingleFloat = SingleFloat.Get();
        SingleFloat actualSingleFloat   = EchoSingleFloat(expectedSingleFloat);

        if (!expectedSingleFloat.Equals(actualSingleFloat))
        {
            Console.WriteLine("EchoSingleFloat failed");
            ok = false;
        }

        SingleDouble expectedSingleDouble = SingleDouble.Get();
        SingleDouble actualSingleDouble   = EchoSingleDouble(expectedSingleDouble);

        if (!expectedSingleDouble.Equals(actualSingleDouble))
        {
            Console.WriteLine("EchoSingleDouble failed");
            ok = false;
        }

        ByteAndFloat expectedByteAndFloat = ByteAndFloat.Get();
        ByteAndFloat actualByteAndFloat   = EchoByteAndFloat(expectedByteAndFloat);

        if (!expectedByteAndFloat.Equals(actualByteAndFloat))
        {
            Console.WriteLine("EchoByteAndFloat failed");
            ok = false;
        }

        LongAndFloat expectedLongAndFloat = LongAndFloat.Get();
        LongAndFloat actualLongAndFloat   = EchoLongAndFloat(expectedLongAndFloat);

        if (!expectedLongAndFloat.Equals(actualLongAndFloat))
        {
            Console.WriteLine("EchoLongAndFloat failed");
            ok = false;
        }

        ByteAndDouble expectedByteAndDouble = ByteAndDouble.Get();
        ByteAndDouble actualByteAndDouble   = EchoByteAndDouble(expectedByteAndDouble);

        if (!expectedByteAndDouble.Equals(actualByteAndDouble))
        {
            Console.WriteLine("EchoByteAndDouble failed");
            ok = false;
        }

        DoubleAndByte expectedDoubleAndByte = DoubleAndByte.Get();
        DoubleAndByte actualDoubleAndByte   = EchoDoubleAndByte(expectedDoubleAndByte);

        if (!expectedDoubleAndByte.Equals(actualDoubleAndByte))
        {
            Console.WriteLine("EchoDoubleAndByte failed");
            ok = false;
        }

        PointerAndByte expectedPointerAndByte = PointerAndByte.Get();
        PointerAndByte actualPointerAndByte   = EchoPointerAndByte(expectedPointerAndByte);

        if (!expectedPointerAndByte.Equals(actualPointerAndByte))
        {
            Console.WriteLine("EchoPointerAndByte failed");
            ok = false;
        }

        ByteAndPointer expectedByteAndPointer = ByteAndPointer.Get();
        ByteAndPointer actualByteAndPointer   = EchoByteAndPointer(expectedByteAndPointer);

        if (!expectedByteAndPointer.Equals(actualByteAndPointer))
        {
            Console.WriteLine("EchoByteAndPointer failed");
            ok = false;
        }

        ByteFloatAndPointer expectedByteFloatAndPointer = ByteFloatAndPointer.Get();
        ByteFloatAndPointer actualByteFloatAndPointer   = EchoByteFloatAndPointer(expectedByteFloatAndPointer);

        if (!expectedByteFloatAndPointer.Equals(actualByteFloatAndPointer))
        {
            Console.WriteLine("EchoByteFloatAndPointer failed");
            ok = false;
        }

        PointerFloatAndByte expectedPointerFloatAndByte = PointerFloatAndByte.Get();
        PointerFloatAndByte actualPointerFloatAndByte   = EchoPointerFloatAndByte(expectedPointerFloatAndByte);

        if (!expectedPointerFloatAndByte.Equals(actualPointerFloatAndByte))
        {
            Console.WriteLine("EchoPointerFloatAndByte failed");
            ok = false;
        }

        TwoLongs expectedTwoLongs = TwoLongs.Get();
        TwoLongs actualTwoLongs   = EchoTwoLongs(expectedTwoLongs);

        if (!expectedTwoLongs.Equals(actualTwoLongs))
        {
            Console.WriteLine("EchoTwoLongs failed");
            ok = false;
        }

        TwoFloats expectedTwoFloats = TwoFloats.Get();
        TwoFloats actualTwoFloats   = EchoTwoFloats(expectedTwoFloats);

        if (!expectedTwoFloats.Equals(actualTwoFloats))
        {
            Console.WriteLine("EchoTwoFloats failed");
            ok = false;
        }

        TwoDoubles expectedTwoDoubles = TwoDoubles.Get();
        TwoDoubles actualTwoDoubles   = EchoTwoDoubles(expectedTwoDoubles);

        if (!expectedTwoDoubles.Equals(actualTwoDoubles))
        {
            Console.WriteLine("EchoTwoDoubles failed");
            ok = false;
        }

        FourLongs expectedFourLongs = FourLongs.Get();
        FourLongs actualFourLongs   = EchoFourLongs(expectedFourLongs);

        if (!expectedFourLongs.Equals(actualFourLongs))
        {
            Console.WriteLine("EchoFourLongs failed");
            ok = false;
        }

        FourDoubles expectedFourDoubles = FourDoubles.Get();
        FourDoubles actualFourDoubles   = EchoFourDoubles(expectedFourDoubles);

        if (!expectedFourDoubles.Equals(actualFourDoubles))
        {
            Console.WriteLine("EchoFourDoubles failed");
            ok = false;
        }

        InlineArray1 expectedInlineArray1 = InlineArray1.Get();
        InlineArray1 actualInlineArray1   = EchoInlineArray1(expectedInlineArray1);

        if (!expectedInlineArray1.Equals(actualInlineArray1))
        {
            Console.WriteLine("EchoInlineArray1 failed");
            ok = false;
        }

        InlineArray2 expectedInlineArray2 = InlineArray2.Get();
        InlineArray2 actualInlineArray2   = EchoInlineArray2(expectedInlineArray2);

        if (!expectedInlineArray2.Equals(actualInlineArray2))
        {
            Console.WriteLine("EchoInlineArray2 failed");
            ok = false;
        }

        InlineArray3 expectedInlineArray3 = InlineArray3.Get();
        InlineArray3 actualInlineArray3   = EchoInlineArray3(expectedInlineArray3);

        if (!expectedInlineArray3.Equals(actualInlineArray3))
        {
            Console.WriteLine("EchoInlineArray3 failed");
            ok = false;
        }

        InlineArray4 expectedInlineArray4 = InlineArray4.Get();
        InlineArray4 actualInlineArray4   = EchoInlineArray4(expectedInlineArray4);

        if (!expectedInlineArray4.Equals(actualInlineArray4))
        {
            Console.WriteLine("EchoInlineArray4 failed");
            ok = false;
        }

        InlineArray5 expectedInlineArray5 = InlineArray5.Get();
        InlineArray5 actualInlineArray5   = EchoInlineArray5(expectedInlineArray5);

        if (!expectedInlineArray5.Equals(actualInlineArray5))
        {
            Console.WriteLine("EchoInlineArray5 failed");
            ok = false;
        }

        InlineArray6 expectedInlineArray6 = InlineArray6.Get();
        InlineArray6 actualInlineArray6   = EchoInlineArray6(expectedInlineArray6);

        if (!expectedInlineArray6.Equals(actualInlineArray6))
        {
            Console.WriteLine("EchoInlineArray6 failed");
            ok = false;
        }

        Nested1 expectedNested1 = Nested1.Get();
        Nested1 actualNested1   = EchoNested1(expectedNested1);

        if (!expectedNested1.Equals(actualNested1))
        {
            Console.WriteLine("EchoNested1 failed");
            ok = false;
        }

        Nested2 expectedNested2 = Nested2.Get();
        Nested2 actualNested2   = EchoNested2(expectedNested2);

        if (!expectedNested2.Equals(actualNested2))
        {
            Console.WriteLine("EchoNested2 failed");
            ok = false;
        }

        Nested3 expectedNested3 = Nested3.Get();
        Nested3 actualNested3   = EchoNested3(expectedNested3);

        if (!expectedNested3.Equals(actualNested3))
        {
            Console.WriteLine("EchoNested3 failed");
            ok = false;
        }

        Nested4 expectedNested4 = Nested4.Get();
        Nested4 actualNested4   = EchoNested4(expectedNested4);

        if (!expectedNested4.Equals(actualNested4))
        {
            Console.WriteLine("EchoNested4 failed");
            ok = false;
        }

        Nested5 expectedNested5 = Nested5.Get();
        Nested5 actualNested5   = EchoNested5(expectedNested5);

        if (!expectedNested5.Equals(actualNested5))
        {
            Console.WriteLine("EchoNested5 failed");
            ok = false;
        }

        Nested6 expectedNested6 = Nested6.Get();
        Nested6 actualNested6   = EchoNested6(expectedNested6);

        if (!expectedNested6.Equals(actualNested6))
        {
            Console.WriteLine("EchoNested6 failed");
            ok = false;
        }

        Nested7 expectedNested7 = Nested7.Get();
        Nested7 actualNested7   = EchoNested7(expectedNested7);

        if (!expectedNested7.Equals(actualNested7))
        {
            Console.WriteLine("EchoNested7 failed");
            ok = false;
        }

        Nested8 expectedNested8 = Nested8.Get();
        Nested8 actualNested8   = EchoNested8(expectedNested8);

        if (!expectedNested8.Equals(actualNested8))
        {
            Console.WriteLine("EchoNested8 failed");
            ok = false;
        }

        Nested9 expectedNested9 = Nested9.Get();
        Nested9 actualNested9   = EchoNested9(expectedNested9);

        if (!expectedNested9.Equals(actualNested9))
        {
            Console.WriteLine("EchoNested9 failed");
            ok = false;
        }

        TwoLongs expectedNotEnoughRegistersSysV1 = TwoLongs.Get();
        TwoLongs actualNotEnoughRegistersSysV1   = NotEnoughRegistersSysV1(1, 2, 3, 4, 5, 6, expectedNotEnoughRegistersSysV1);

        if (!expectedNotEnoughRegistersSysV1.Equals(actualNotEnoughRegistersSysV1))
        {
            Console.WriteLine("NotEnoughRegistersSysV1 failed");
            ok = false;
        }

        TwoLongs expectedNotEnoughRegistersSysV2 = TwoLongs.Get();
        TwoLongs actualNotEnoughRegistersSysV2   = NotEnoughRegistersSysV2(1, 2, 3, 4, 5, expectedNotEnoughRegistersSysV2);

        if (!expectedNotEnoughRegistersSysV2.Equals(actualNotEnoughRegistersSysV2))
        {
            Console.WriteLine("NotEnoughRegistersSysV2 failed");
            ok = false;
        }

        DoubleAndByte expectedNotEnoughRegistersSysV3 = DoubleAndByte.Get();
        DoubleAndByte actualNotEnoughRegistersSysV3   = NotEnoughRegistersSysV3(1, 2, 3, 4, 5, 6, expectedNotEnoughRegistersSysV3);

        if (!expectedNotEnoughRegistersSysV3.Equals(actualNotEnoughRegistersSysV3))
        {
            Console.WriteLine("NotEnoughRegistersSysV3 failed");
            ok = false;
        }

        TwoDoubles expectedNotEnoughRegistersSysV4 = TwoDoubles.Get();
        TwoDoubles actualNotEnoughRegistersSysV4   = NotEnoughRegistersSysV4(1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d, 8.0d, expectedNotEnoughRegistersSysV4);

        if (!expectedNotEnoughRegistersSysV4.Equals(actualNotEnoughRegistersSysV4))
        {
            Console.WriteLine("NotEnoughRegistersSysV4 failed");
            ok = false;
        }

        TwoDoubles expectedNotEnoughRegistersSysV5 = TwoDoubles.Get();
        TwoDoubles actualNotEnoughRegistersSysV5   = NotEnoughRegistersSysV5(1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d, expectedNotEnoughRegistersSysV5);

        if (!expectedNotEnoughRegistersSysV5.Equals(actualNotEnoughRegistersSysV5))
        {
            Console.WriteLine("NotEnoughRegistersSysV5 failed");
            ok = false;
        }

        DoubleAndByte expectedNotEnoughRegistersSysV6 = DoubleAndByte.Get();
        DoubleAndByte actualNotEnoughRegistersSysV6   = NotEnoughRegistersSysV6(1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d, 8.0d, expectedNotEnoughRegistersSysV6);

        if (!expectedNotEnoughRegistersSysV6.Equals(actualNotEnoughRegistersSysV6))
        {
            Console.WriteLine("NotEnoughRegistersSysV6 failed");
            ok = false;
        }

        TwoDoubles expectedEnoughRegistersSysV1 = TwoDoubles.Get();
        TwoDoubles actualEnoughRegistersSysV1   = EnoughRegistersSysV1(1, 2, 3, 4, 5, 6, expectedEnoughRegistersSysV1);

        if (!expectedEnoughRegistersSysV1.Equals(actualEnoughRegistersSysV1))
        {
            Console.WriteLine("EnoughRegistersSysV1 failed");
            ok = false;
        }

        DoubleAndByte expectedEnoughRegistersSysV2 = DoubleAndByte.Get();
        DoubleAndByte actualEnoughRegistersSysV2   = EnoughRegistersSysV2(1, 2, 3, 4, 5, expectedEnoughRegistersSysV2);

        if (!expectedEnoughRegistersSysV2.Equals(actualEnoughRegistersSysV2))
        {
            Console.WriteLine("EnoughRegistersSysV2 failed");
            ok = false;
        }

        TwoLongs expectedEnoughRegistersSysV3 = TwoLongs.Get();
        TwoLongs actualEnoughRegistersSysV3   = EnoughRegistersSysV3(1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d, 8.0d, expectedEnoughRegistersSysV3);

        if (!expectedEnoughRegistersSysV3.Equals(actualEnoughRegistersSysV3))
        {
            Console.WriteLine("EnoughRegistersSysV3 failed");
            ok = false;
        }

        DoubleAndByte expectedEnoughRegistersSysV4 = DoubleAndByte.Get();
        DoubleAndByte actualEnoughRegistersSysV4   = EnoughRegistersSysV4(1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d, expectedEnoughRegistersSysV4);

        if (!expectedEnoughRegistersSysV4.Equals(actualEnoughRegistersSysV4))
        {
            Console.WriteLine("EnoughRegistersSysV4 failed");
            ok = false;
        }

        return(ok ? 100 : -1);
    }
Esempio n. 7
0
 static extern InlineArray2 EchoInlineArray2(InlineArray2 value);