Skip to content

Commit a798ece

Browse files
Copilotmrdav30
andcommitted
Apply review feedback: rename MsgPack tests, fix Union Version, CI workflow, null check, separate exceptions
Co-authored-by: mrdav30 <11547347+mrdav30@users.noreply.github.com>
1 parent abdc37e commit a798ece

14 files changed

Lines changed: 20 additions & 22 deletions

.github/workflows/dotnet.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ on:
1313

1414
jobs:
1515
build-and-test:
16-
if: |
17-
(github.event_name != 'pull_request' && !github.event.pull_request.head.repo.fork)
18-
|| (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork
19-
|| startsWith(github.head_ref, 'dependabot/')))
2016
runs-on: ${{ matrix.os }}
2117

2218
strategy:

src/FixedMathSharp/Bounds/BoundingBox.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ public static BoundingBox Union(BoundingBox a, BoundingBox b)
392392
{
393393
Min = Vector3d.Min(a.Min, b.Min),
394394
Max = Vector3d.Max(a.Max, b.Max),
395+
Version = Math.Max(a.Version, b.Version),
395396
_isDirty = true
396397
};
397398
}

src/FixedMathSharp/Numerics/FixedQuaternion.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,12 @@ public static FixedQuaternion FromEulerAnglesInDegrees(Fixed64 pitch, Fixed64 ya
408408
public static FixedQuaternion FromEulerAngles(Fixed64 pitch, Fixed64 yaw, Fixed64 roll)
409409
{
410410
// Check if the angles are in a valid range (-pi, pi)
411-
if (pitch < -FixedMath.PI || pitch > FixedMath.PI ||
412-
yaw < -FixedMath.PI || yaw > FixedMath.PI ||
413-
roll < -FixedMath.PI || roll > FixedMath.PI)
414-
{
415-
throw new ArgumentOutOfRangeException(nameof(pitch), $"Euler angles must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but were ({pitch}, {yaw}, {roll})");
416-
}
411+
if (pitch < -FixedMath.PI || pitch > FixedMath.PI)
412+
throw new ArgumentOutOfRangeException(nameof(pitch), pitch, $"Pitch must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but was {pitch}");
413+
if (yaw < -FixedMath.PI || yaw > FixedMath.PI)
414+
throw new ArgumentOutOfRangeException(nameof(yaw), yaw, $"Yaw must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but was {yaw}");
415+
if (roll < -FixedMath.PI || roll > FixedMath.PI)
416+
throw new ArgumentOutOfRangeException(nameof(roll), roll, $"Roll must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but was {roll}");
417417

418418
Fixed64 c1 = FixedMath.Cos(yaw / Fixed64.Two);
419419
Fixed64 s1 = FixedMath.Sin(yaw / Fixed64.Two);

tests/FixedMathSharp.Tests/Bounds/BoundingArea.Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void BoundingArea_NetSerialization_RoundTripMaintainsData()
192192
}
193193

194194
[Fact]
195-
public void BoundingArea_MsgPackSerialization_RoundTripMaintainsData()
195+
public void BoundingArea_MemoryPackSerialization_RoundTripMaintainsData()
196196
{
197197
BoundingArea originalValue = new(
198198
new Vector3d(1, 2, 3),

tests/FixedMathSharp.Tests/Bounds/BoundingBox.Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public void BoundingBox_NetSerialization_RoundTripMaintainsData()
266266
}
267267

268268
[Fact]
269-
public void BoundingBox_MsgPackSerialization_RoundTripMaintainsData()
269+
public void BoundingBox_MemoryPackSerialization_RoundTripMaintainsData()
270270
{
271271
BoundingBox originalValue = new(new Vector3d(0, 0, 0), new Vector3d(4, 4, 4));
272272

@@ -278,7 +278,7 @@ public void BoundingBox_MsgPackSerialization_RoundTripMaintainsData()
278278
}
279279

280280
[Fact]
281-
public void MsgPack_SerializedBox_RemainsMutable()
281+
public void MemoryPack_SerializedBox_RemainsMutable()
282282
{
283283
var box = new BoundingBox(new Vector3d(0, 0, 0), new Vector3d(4, 4, 4));
284284

tests/FixedMathSharp.Tests/Bounds/BoundingSphere.Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public void BoundingSphere_NetSerialization_RoundTripMaintainsData()
203203
}
204204

205205
[Fact]
206-
public void BoundingSphere_MsgPackSerialization_RoundTripMaintainsData()
206+
public void BoundingSphere_MemoryPackSerialization_RoundTripMaintainsData()
207207
{
208208
BoundingSphere originalValue = new(new Vector3d(1, 1, 1), new Fixed64(2));
209209

tests/FixedMathSharp.Tests/Fixed3x3.Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public void Fixed3x3_NetSerialization_RoundTripMaintainsData()
335335
}
336336

337337
[Fact]
338-
public void Fixed3x3_MsgPackSerialization_RoundTripMaintainsData()
338+
public void Fixed3x3_MemoryPackSerialization_RoundTripMaintainsData()
339339
{
340340
Fixed3x3 originalValue = Fixed3x3.CreateRotationX(FixedMath.PiOver2); // 90 degrees
341341

tests/FixedMathSharp.Tests/Fixed4x4.Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public void Fixed4x4_NetSerialization_RoundTripMaintainsData()
332332
}
333333

334334
[Fact]
335-
public void Fixed4x4_MsgPackSerialization_RoundTripMaintainsData()
335+
public void Fixed4x4_MemoryPackSerialization_RoundTripMaintainsData()
336336
{
337337
var translation = new Vector3d(1, 2, 3);
338338
var rotation = FixedQuaternion.FromEulerAnglesInDegrees(Fixed64.Zero, FixedMath.PiOver2, Fixed64.Zero);

tests/FixedMathSharp.Tests/Fixed64.Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public void Fixed64_NetSerialization_RoundTripMaintainsData()
211211
}
212212

213213
[Fact]
214-
public void Fixed64_MsgPackSerialization_RoundTripMaintainsData()
214+
public void Fixed64_MemoryPackSerialization_RoundTripMaintainsData()
215215
{
216216
Fixed64 originalValue = FixedMath.PI;
217217

tests/FixedMathSharp.Tests/FixedCurveTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ public void FixedCurve_NetSerialization_RoundTripMaintainsData()
141141
};
142142
var json = JsonSerializer.SerializeToUtf8Bytes(originalCurve, jsonOptions);
143143
var deserializedCurve = JsonSerializer.Deserialize<FixedCurve>(json, jsonOptions);
144+
Assert.NotNull(deserializedCurve);
144145

145146
// Check that deserialized values match the original
146147
Assert.Equal(originalCurve, deserializedCurve);
147148
}
148149

149150
[Fact]
150-
public void FixedCurve_MsgPackSerialization_RoundTripMaintainsData()
151+
public void FixedCurve_MemoryPackSerialization_RoundTripMaintainsData()
151152
{
152153
FixedCurve originalValue = new FixedCurve(
153154
new FixedCurveKey(-10, -100),

0 commit comments

Comments
 (0)