コード例 #1
0
        private unsafe static void ToStringInt64()
        {
            int size = Unsafe.SizeOf <Vector64 <Int64> >() / sizeof(Int64);

            Int64[] values = new Int64[size];

            for (int i = 0; i < size; i++)
            {
                values[i] = TestLibrary.Generator.GetInt64();
            }

            Vector64 <Int64> vector = Vector64.Create(values[0]);
            string           actual = vector.ToString();

            string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>';

            bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal);

            if (!succeeded)
            {
                TestLibrary.TestFramework.LogInformation($"Vector64Int64ToString: Vector64<Int64>.ToString() returned an unexpected result.");
                TestLibrary.TestFramework.LogInformation($"Expected: {expected}");
                TestLibrary.TestFramework.LogInformation($"Actual: {actual}");
                TestLibrary.TestFramework.LogInformation(string.Empty);

                throw new Exception("One or more scenarios did not complete as expected.");
            }
        }