public void ToJson_StructWithInt32Property_DoesNotAllocate() { var container = new StructWithInt32Property(); GCAllocTest.Method(() => { using (var writer = new JsonStringBuffer(16, Allocator.Temp)) { JsonSerialization.ToJson(writer, container); } }) .ExpectedCount(0) .Warmup() .Run(); }
public void ToBinary_StructWithInt32Property_DoesNotAllocate() { var container = new StructWithInt32Property(); GCAllocTest.Method(() => { using (var stream = new UnsafeAppendBuffer(16, 8, Allocator.Temp)) { BinarySerialization.ToBinary(&stream, container); } }) .ExpectedCount(0) .Warmup() .Run(); }
public void FromBinary_StructWithInt32Property_DoesNotAllocate() { var container = new StructWithInt32Property(); using (var writer = new UnsafeAppendBuffer(16, 8, Allocator.Temp)) { var writerPtr = &writer; BinarySerialization.ToBinary(writerPtr, container); GCAllocTest.Method(() => { var reader = writerPtr->AsReader(); var readerPtr = &reader; BinarySerialization.FromBinary <StructWithInt32Property>(readerPtr); }) .ExpectedCount(0) .Warmup() .Run(); } }