提交 1e953232 编写于 作者: L Lakshmi Priya

Merge pull request dotnet/corefx#276 from Priya91/formatting-numerics

Formatting changes to Numerics

Commit migrated from https://github.com/dotnet/corefx/commit/2604f2a501cc49f9ad3ade60837d2759579f2746
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Globalization;
......
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.Numerics
......
......@@ -989,22 +989,22 @@ public unsafe void Matrix3x2SizeofTest()
[StructLayout(LayoutKind.Sequential)]
struct Matrix3x2_2x
{
Matrix3x2 a;
Matrix3x2 b;
private Matrix3x2 _a;
private Matrix3x2 _b;
}
[StructLayout(LayoutKind.Sequential)]
struct Matrix3x2PlusFloat
{
Matrix3x2 v;
float f;
private Matrix3x2 _v;
private float _f;
}
[StructLayout(LayoutKind.Sequential)]
struct Matrix3x2PlusFloat_2x
{
Matrix3x2PlusFloat a;
Matrix3x2PlusFloat b;
private Matrix3x2PlusFloat _a;
private Matrix3x2PlusFloat _b;
}
// A test to make sure the fields are laid out how we expect
......
......@@ -1505,7 +1505,7 @@ public void Matrix4x4ToStringTest()
21.0f, 22.0f, 23.0f, 24.0f,
31.0f, 32.0f, 33.0f, 34.0f,
41.0f, 42.0f, 43.0f, 44.0f);
string actual = a.ToString();
Assert.Equal(expected, actual);
}
......@@ -2465,22 +2465,22 @@ public unsafe void Matrix4x4SizeofTest()
[StructLayout(LayoutKind.Sequential)]
struct Matrix4x4_2x
{
Matrix4x4 a;
Matrix4x4 b;
private Matrix4x4 _a;
private Matrix4x4 _b;
}
[StructLayout(LayoutKind.Sequential)]
struct Matrix4x4PlusFloat
{
Matrix4x4 v;
float f;
private Matrix4x4 _v;
private float _f;
}
[StructLayout(LayoutKind.Sequential)]
struct Matrix4x4PlusFloat_2x
{
Matrix4x4PlusFloat a;
Matrix4x4PlusFloat b;
private Matrix4x4PlusFloat _a;
private Matrix4x4PlusFloat _b;
}
// A test to make sure the fields are laid out how we expect
......
......@@ -329,22 +329,22 @@ public unsafe void PlaneSizeofTest()
[StructLayout(LayoutKind.Sequential)]
struct Plane_2x
{
Plane a;
Plane b;
private Plane _a;
private Plane _b;
}
[StructLayout(LayoutKind.Sequential)]
struct PlanePlusFloat
{
Plane v;
float f;
private Plane _v;
private float _f;
}
[StructLayout(LayoutKind.Sequential)]
struct PlanePlusFloat_2x
{
PlanePlusFloat a;
PlanePlusFloat b;
private PlanePlusFloat _a;
private PlanePlusFloat _b;
}
// A test to make sure the fields are laid out how we expect
......
......@@ -947,22 +947,22 @@ public unsafe void QuaternionSizeofTest()
[StructLayout(LayoutKind.Sequential)]
struct Quaternion_2x
{
Quaternion a;
Quaternion b;
private Quaternion _a;
private Quaternion _b;
}
[StructLayout(LayoutKind.Sequential)]
struct QuaternionPlusFloat
{
Quaternion v;
float f;
private Quaternion _v;
private float _f;
}
[StructLayout(LayoutKind.Sequential)]
struct QuaternionPlusFloat_2x
{
QuaternionPlusFloat a;
QuaternionPlusFloat b;
private QuaternionPlusFloat _a;
private QuaternionPlusFloat _b;
}
// A test to make sure the fields are laid out how we expect
......
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Linq;
......@@ -7,10 +7,10 @@ namespace System.Numerics.Tests
{
public static class Util
{
static Random random = new Random();
private static Random s_random = new Random();
public static void SetRandomSeed(int seed)
{
random = new Random(seed);
s_random = new Random(seed);
}
/// <summary>
......@@ -23,7 +23,7 @@ public static float[] GenerateRandomFloats(int numValues)
float[] values = new float[numValues];
for (int g = 0; g < numValues; g++)
{
values[g] = (float)(random.NextDouble() * 99 + 1);
values[g] = (float)(s_random.NextDouble() * 99 + 1);
}
return values;
}
......@@ -38,7 +38,7 @@ public static int[] GenerateRandomInts(int numValues)
int[] values = new int[numValues];
for (int g = 0; g < numValues; g++)
{
values[g] = random.Next(1, 100);
values[g] = s_random.Next(1, 100);
}
return values;
}
......@@ -53,7 +53,7 @@ public static double[] GenerateRandomDoubles(int numValues)
double[] values = new double[numValues];
for (int g = 0; g < numValues; g++)
{
values[g] = random.NextDouble() * 99 + 1;
values[g] = s_random.NextDouble() * 99 + 1;
}
return values;
}
......@@ -68,7 +68,7 @@ public static long[] GenerateRandomLongs(int numValues)
long[] values = new long[numValues];
for (int g = 0; g < numValues; g++)
{
values[g] = random.Next(1, 100) * (long.MaxValue / int.MaxValue);
values[g] = s_random.Next(1, 100) * (long.MaxValue / int.MaxValue);
}
return values;
}
......@@ -86,7 +86,7 @@ public static long[] GenerateRandomLongs(int numValues)
public static T GenerateSingleValue<T>(int min = 1, int max = 100) where T : struct
{
var randomRange = random.Next(min, max);
var randomRange = s_random.Next(min, max);
T value = (T)(dynamic)randomRange;
return value;
}
......
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Globalization;
......@@ -1109,22 +1109,22 @@ public unsafe void Vector2SizeofTest()
[StructLayout(LayoutKind.Sequential)]
struct Vector2_2x
{
Vector2 a;
Vector2 b;
private Vector2 _a;
private Vector2 _b;
}
[StructLayout(LayoutKind.Sequential)]
struct Vector2PlusFloat
{
Vector2 v;
float f;
private Vector2 _v;
private float _f;
}
[StructLayout(LayoutKind.Sequential)]
struct Vector2PlusFloat_2x
{
Vector2PlusFloat a;
Vector2PlusFloat b;
private Vector2PlusFloat _a;
private Vector2PlusFloat _b;
}
[Fact]
......
......@@ -739,7 +739,6 @@ public void Vector3DivisionTest2()
Assert.True(float.IsNegativeInfinity(actual.X), "Vector3f.operator / did not return the expected value.");
Assert.True(float.IsPositiveInfinity(actual.Y), "Vector3f.operator / did not return the expected value.");
Assert.True(float.IsPositiveInfinity(actual.Z), "Vector3f.operator / did not return the expected value.");
}
// A test for operator / (Vector3f, Vector3f)
......@@ -1123,22 +1122,22 @@ public unsafe void Vector3SizeofTest()
[StructLayout(LayoutKind.Sequential)]
struct Vector3_2x
{
Vector3 a;
Vector3 b;
private Vector3 _a;
private Vector3 _b;
}
[StructLayout(LayoutKind.Sequential)]
struct Vector3PlusFloat
{
Vector3 v;
float f;
private Vector3 _v;
private float _f;
}
[StructLayout(LayoutKind.Sequential)]
struct Vector3PlusFloat_2x
{
Vector3PlusFloat a;
Vector3PlusFloat b;
private Vector3PlusFloat _a;
private Vector3PlusFloat _b;
}
[Fact]
......
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Globalization;
......@@ -1363,22 +1363,22 @@ public unsafe void Vector4SizeofTest()
[StructLayout(LayoutKind.Sequential)]
struct Vector4_2x
{
Vector4 a;
Vector4 b;
private Vector4 _a;
private Vector4 _b;
}
[StructLayout(LayoutKind.Sequential)]
struct Vector4PlusFloat
{
Vector4 v;
float f;
private Vector4 _v;
private float _f;
}
[StructLayout(LayoutKind.Sequential)]
struct Vector4PlusFloat_2x
{
Vector4PlusFloat a;
Vector4PlusFloat b;
private Vector4PlusFloat _a;
private Vector4PlusFloat _b;
}
[Fact]
......@@ -1517,38 +1517,38 @@ public static DeeplyEmbeddedStruct Create()
public Vector4 RootEmbeddedObject { get { return L0.L1.L2.L3.L4.L5.L6.L7.EmbeddedVector; } }
public struct Level0
{
private float buffer0, buffer1;
private float _buffer0, _buffer1;
public Level1 L1;
private float buffer2;
private float _buffer2;
public struct Level1
{
private float buffer0, buffer1;
private float _buffer0, _buffer1;
public Level2 L2;
private byte buffer2;
private byte _buffer2;
public struct Level2
{
public Level3 L3;
private float buffer0;
private byte buffer1;
private float _buffer0;
private byte _buffer1;
public struct Level3
{
public Level4 L4;
public struct Level4
{
private float buffer0;
private float _buffer0;
public Level5 L5;
private long buffer1;
private byte buffer2;
private double buffer3;
private long _buffer1;
private byte _buffer2;
private double _buffer3;
public struct Level5
{
private byte buffer0;
private byte _buffer0;
public Level6 L6;
public struct Level6
{
private byte buffer0;
private byte _buffer0;
public Level7 L7;
private byte buffer1, buffer2;
private byte _buffer1, _buffer2;
public struct Level7
{
public Vector4 EmbeddedVector;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册