public void ShouldMutateValueFromArray() { var array = Enumerable.Range(0, 2000).Select(x => new StubValueEvent(x)).ToArray(); for (var i = 0; i < array.Length; i++) { ref var evt = ref InternalUtil.ReadValue <StubValueEvent>(array, i); evt.TestString = evt.Value.ToString(); }
public void ShouldReadValueAtIndexUnaligned() { var array = Enumerable.Range(0, 2000).Select(x => new UnalignedEvent(x)).ToArray(); for (var i = 0; i < array.Length; i++) { var evt = InternalUtil.ReadValue <UnalignedEvent>(array, i); Assert.AreEqual(new UnalignedEvent(i), evt); } }
public void ShouldReadValueFromPointer() { var index = 0; using (var memory = UnmanagedRingBufferMemory.Allocate(2048, () => new StubUnmanagedEvent(index++))) { for (var i = 0; i < memory.EventCount; i++) { var evt = InternalUtil.ReadValue <StubUnmanagedEvent>(memory.PointerToFirstEvent, i, memory.EventSize); Assert.AreEqual(new StubUnmanagedEvent(i), evt); } } }
public unsafe int ReadOneILUnsafe() { return(InternalUtil.ReadValue <Event>(_pointer, Index, sizeof(Event)).Value); }
public int ReadOneIL() { return(InternalUtil.ReadValue <Event>(_array, Index).Value); }