示例#1
0
    static int Main()
    {
        int returnVal = Pass;

        for (int i = 0; i < 10; i++)
        {
            Vector <Single> singleVector = getRandomVector <Single>(singles, i);
            if (VectorConvertTest.VectorConvertSingleInt(singleVector) != Pass)
            {
                Console.WriteLine("Testing Converts Between Single and Int32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Single> singleVector = getRandomVector <Single>(singles, i);
            if (VectorConvertTest.VectorConvertSingleUInt(singleVector) != Pass)
            {
                Console.WriteLine("Testing Converts Between Single and UInt32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector = getRandomVector <Double>(doubles, i);
            if (VectorConvertTest.VectorConvertDoubleInt64(doubleVector) != Pass)
            {
                Console.WriteLine("Testing Converts between Double and Int64 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector = getRandomVector <Double>(doubles, i);
            if (VectorConvertTest.VectorConvertDoubleUInt64(doubleVector) != Pass)
            {
                Console.WriteLine("Testing Converts between Double and UInt64 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector1 = getRandomVector <Double>(doubles, i);
            Vector <Double> doubleVector2 = getRandomVector <Double>(doubles, i);
            if (VectorConvertTest.VectorConvertDoubleSingle(doubleVector1, doubleVector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Single and Double failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int64> int64Vector1 = getRandomVector <Int64>(int64s, i);
            Vector <Int64> int64Vector2 = getRandomVector <Int64>(int64s, i);
            if (VectorConvertTest.VectorConvertInt64And32(int64Vector1, int64Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int64 and Int32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int32> int32Vector1 = getRandomVector <Int32>(int32s, i);
            Vector <Int32> int32Vector2 = getRandomVector <Int32>(int32s, i);
            if (VectorConvertTest.VectorConvertInt32And16(int32Vector1, int32Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int32 and Int16 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int16> int16Vector1 = getRandomVector <Int16>(int16s, i);
            Vector <Int16> int16Vector2 = getRandomVector <Int16>(int16s, i);
            if (VectorConvertTest.VectorConvertInt16And8(int16Vector1, int16Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int16 and SByte failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt64> uint64Vector1 = getRandomVector <UInt64>(uint64s, i);
            Vector <UInt64> uint64Vector2 = getRandomVector <UInt64>(uint64s, i);
            if (VectorConvertTest.VectorConvertUInt64And32(uint64Vector1, uint64Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt64 and UInt32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt32> uint32Vector1 = getRandomVector <UInt32>(uint32s, i);
            Vector <UInt32> uint32Vector2 = getRandomVector <UInt32>(uint32s, i);
            if (VectorConvertTest.VectorConvertUInt32And16(uint32Vector1, uint32Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt32 and UInt16 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt16> uint16Vector1 = getRandomVector <UInt16>(uint16s, i);
            Vector <UInt16> uint16Vector2 = getRandomVector <UInt16>(uint16s, i);
            if (VectorConvertTest.VectorConvertUInt16And8(uint16Vector1, uint16Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt16 and Byte failed");
                returnVal = Fail;
            }
        }

        JitLog jitLog = new JitLog();

        // SIMD conversions from floating point to unsigned are not supported on x86 or x64

        if (!jitLog.Check("System.Numerics.Vector:ConvertToInt32(struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:ConvertToSingle(struct):struct"))
        {
            returnVal = Fail;
        }
        // SIMD Conversion to Int64 is not supported on x86
#if !BIT32
        if (!jitLog.Check("System.Numerics.Vector:ConvertToInt64(struct):struct"))
        {
            returnVal = Fail;
        }
#endif // !BIT32
        if (!jitLog.Check("System.Numerics.Vector:ConvertToDouble(struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:Narrow(struct,struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:Widen(struct,byref,byref)"))
        {
            returnVal = Fail;
        }
        jitLog.Dispose();

        return(returnVal);
    }