Skip to content

Commit aa3a121

Browse files
test-fix
Fixing issue with the scene handle test and running in the "in-between" 6.4 version of Unity.
1 parent d548a63 commit aa3a121

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

com.unity.netcode.gameobjects/Tests/Editor/Serialization/NetworkSceneHandleTests.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ public void NetworkSceneHandleSerializationTest()
1414
Assert.That(writer.Position, Is.EqualTo(0), "Writer position should be zero");
1515

1616
writer.WriteValue(handle);
17-
18-
Assert.That(writer.Position, Is.EqualTo(sizeof(ulong)), "Writer position should not be beyond size");
17+
#if SCENE_MANAGEMENT_SCENE_HANDLE_MUST_USE_ULONG
18+
Assert.That(writer.Position, Is.EqualTo(sizeof(ulong)), $"Writer position should not be beyond size! Expected: {sizeof(ulong)} Actual: {writer.Position}");
19+
#else
20+
Assert.That(writer.Position, Is.EqualTo(sizeof(int)), $"Writer position should not be beyond size! Expected: {sizeof(int)} Actual: {writer.Position}");
21+
#endif
1922

2023
var reader = new FastBufferReader(writer, Allocator.Temp);
2124
Assert.That(reader.Position, Is.EqualTo(0), "Reader position should be zero");
2225
reader.ReadValue(out NetworkSceneHandle deserializedHandle);
23-
Assert.That(writer.Position, Is.EqualTo(sizeof(ulong)), "Reader position should not be beyond size");
26+
#if SCENE_MANAGEMENT_SCENE_HANDLE_MUST_USE_ULONG
27+
Assert.That(reader.Position, Is.EqualTo(sizeof(ulong)), $"Reader position should not be beyond size! Expected: {sizeof(ulong)} Actual: {reader.Position}");
28+
#else
29+
Assert.That(reader.Position, Is.EqualTo(sizeof(int)), $"Reader position should not be beyond size! Expected: {sizeof(int)} Actual: {reader.Position}");
30+
#endif
2431

2532
Assert.AreEqual(handle, deserializedHandle);
2633

@@ -32,14 +39,17 @@ public void NetworkSceneHandleSerializationTest()
3239
Assert.That(listWriter.Position, Is.EqualTo(0), "Writer position should be zero");
3340

3441
listWriter.WriteValue(handles);
35-
42+
#if SCENE_MANAGEMENT_SCENE_HANDLE_MUST_USE_ULONG
3643
var expectedSize = sizeof(int) + (sizeof(ulong) * handles.Length);
37-
Assert.That(listWriter.Position, Is.EqualTo(expectedSize), "Writer position should not be beyond size");
44+
#else
45+
var expectedSize = sizeof(int) + (sizeof(int) * handles.Length);
46+
#endif
47+
Assert.That(listWriter.Position, Is.EqualTo(expectedSize), $"Writer position should not be beyond size! Expected: {expectedSize} Actual: {listWriter.Position}");
3848

3949
var listReader = new FastBufferReader(listWriter, Allocator.Temp);
4050
Assert.That(listReader.Position, Is.EqualTo(0), "Reader position should be zero");
4151
listReader.ReadValue(out NetworkSceneHandle[] deserializedHandleList);
42-
Assert.That(listReader.Position, Is.EqualTo(expectedSize), "Reader position should not be beyond expected size");
52+
Assert.That(listReader.Position, Is.EqualTo(expectedSize), $"Reader position should not be beyond expected size! Expected: {expectedSize} Actual: {listReader.Position}");
4353

4454
Assert.AreEqual(handles, deserializedHandleList);
4555
}

0 commit comments

Comments
 (0)