Skip to content

Commit

Permalink
format again
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Jun 25, 2024
1 parent 24e92e7 commit c6de4b2
Show file tree
Hide file tree
Showing 23 changed files with 1,375 additions and 1,411 deletions.
8 changes: 1 addition & 7 deletions Speckle.DoubleNumerics.Tests/Common/System/PlatDetect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,7 @@ private static Version GetOSXKernelVersion()
}

[DllImport("libc", SetLastError = true)]
private static extern int sysctlbyname(
string ctlName,
byte[] oldp,
ref IntPtr oldpLen,
byte[]? newp,
IntPtr newpLen
);
private static extern int sysctlbyname(string ctlName, byte[] oldp, ref IntPtr oldpLen, byte[]? newp, IntPtr newpLen);

[DllImport("ntdll.dll")]
private static extern int RtlGetVersion(out RTL_OSVERSIONINFOEX lpVersionInformation);
Expand Down
142 changes: 71 additions & 71 deletions Speckle.DoubleNumerics.Tests/ConstantHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,140 +12,140 @@ internal class ConstantHelper
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Byte GetByteWithAllBitsSet()
{
Byte value = 0;
unsafe
Byte value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = 0xff;
}
*&value = 0xff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static SByte GetSByteWithAllBitsSet()
{
SByte value = 0;
unsafe
SByte value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = (SByte)0xff;
}
*&value = (SByte)0xff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static UInt16 GetUInt16WithAllBitsSet()
{
UInt16 value = 0;
unsafe
UInt16 value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = 0xffff;
}
*&value = 0xffff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Int16 GetInt16WithAllBitsSet()
{
Int16 value = 0;
unsafe
Int16 value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = (Int16)0xffff;
}
*&value = (Int16)0xffff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static UInt32 GetUInt32WithAllBitsSet()
{
UInt32 value = 0;
unsafe
UInt32 value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = 0xffffffff;
}
*&value = 0xffffffff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Int32 GetInt32WithAllBitsSet()
{
Int32 value = 0;
unsafe
Int32 value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = (Int32)0xffffffff;
}
*&value = (Int32)0xffffffff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static UInt64 GetUInt64WithAllBitsSet()
{
UInt64 value = 0;
unsafe
UInt64 value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = 0xffffffffffffffff;
}
*&value = 0xffffffffffffffff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Int64 GetInt64WithAllBitsSet()
{
Int64 value = 0;
unsafe
Int64 value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = (Int64)0xffffffffffffffff;
}
*&value = (Int64)0xffffffffffffffff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Double GetDoubleWithAllBitsSet()
{
Double value = 0;
unsafe
Double value = 0;
unsafe
{
unchecked
{
unchecked
{
*((Int32*)&value) = (Int32)0xffffffffffffffff;
}
*((Int32*)&value) = (Int32)0xffffffffffffffff;
}
return value;
}
return value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Single GetSingleWithAllBitsSet()
{
Single value = 0;
unsafe
Single value = 0;
unsafe
{
unchecked
{
unchecked
{
*&value = 0xffffffff;
}
*&value = 0xffffffff;
}
return value;
}
}
return value;
}
}
8 changes: 5 additions & 3 deletions Speckle.DoubleNumerics.Tests/MathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static class MathHelper

public static bool Equal(Vector3 a, Vector3 b) => Equal(a.X, b.X) && Equal(a.Y, b.Y) && Equal(a.Z, b.Z);

public static bool Equal(Vector4 a, Vector4 b) => Equal(a.X, b.X) && Equal(a.Y, b.Y) && Equal(a.Z, b.Z) && Equal(a.W, b.W);
public static bool Equal(Vector4 a, Vector4 b) =>
Equal(a.X, b.X) && Equal(a.Y, b.Y) && Equal(a.Z, b.Z) && Equal(a.W, b.W);

public static bool Equal(Matrix4x4 a, Matrix4x4 b) =>
Equal(a.M11, b.M11)
Expand Down Expand Up @@ -52,7 +53,8 @@ public static bool Equal(Matrix3x2 a, Matrix3x2 b) =>

public static bool Equal(Plane a, Plane b) => Equal(a.Normal, b.Normal) && Equal(a.D, b.D);

public static bool Equal(Quaternion a, Quaternion b) => Equal(a.X, b.X) && Equal(a.Y, b.Y) && Equal(a.Z, b.Z) && Equal(a.W, b.W);
public static bool Equal(Quaternion a, Quaternion b) =>
Equal(a.X, b.X) && Equal(a.Y, b.Y) && Equal(a.Z, b.Z) && Equal(a.W, b.W);

public static bool EqualRotation(Quaternion a, Quaternion b) => Equal(a, b) || Equal(a, -b);
}
}
13 changes: 6 additions & 7 deletions Speckle.DoubleNumerics.Tests/Matrix3x2Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public void Matrix3x2InvertScaleTest()
[Fact]
public void Matrix3x2InvertAffineTest()
{
Matrix3x2 mtx =
Matrix3x2.CreateRotation(2) * Matrix3x2.CreateScale(23, -42) * Matrix3x2.CreateTranslation(17, 53);
Matrix3x2 mtx = Matrix3x2.CreateRotation(2) * Matrix3x2.CreateScale(23, -42) * Matrix3x2.CreateTranslation(17, 53);

Matrix3x2 actual;
Assert.True(Matrix3x2.Invert(mtx, out actual));
Expand Down Expand Up @@ -298,11 +297,11 @@ public void Matrix3x2InvertTest1()
// all the elements in Actual is NaN
Assert.True(
double.IsNaN(actual.M11)
&& double.IsNaN(actual.M12)
&& double.IsNaN(actual.M21)
&& double.IsNaN(actual.M22)
&& double.IsNaN(actual.M31)
&& double.IsNaN(actual.M32),
&& double.IsNaN(actual.M12)
&& double.IsNaN(actual.M21)
&& double.IsNaN(actual.M22)
&& double.IsNaN(actual.M31)
&& double.IsNaN(actual.M32),
"Matrix3x2.Invert did not return the expected value."
);
}
Expand Down
Loading

0 comments on commit c6de4b2

Please sign in to comment.