public void ParallelIncrementIncrementsValue() { using (NativeIntPtr intPtr = new NativeIntPtr(Allocator.Temp, 123)) { NativeIntPtr.Parallel parallel = intPtr.GetParallel(); parallel.Increment(); Assert.That(intPtr.Value, Is.EqualTo(124)); } }
public void ParallelAddRequiresReadAccess() { using (NativeIntPtr intPtr = new NativeIntPtr(Allocator.Temp)) { NativeIntPtr.Parallel parallel = intPtr.GetParallel(); AssertRequiresReadOrWriteAccess( intPtr, () => parallel.Add(10)); } }
public void ParallelDecrementRequiresReadAccess() { using (NativeIntPtr intPtr = new NativeIntPtr(Allocator.Temp)) { NativeIntPtr.Parallel parallel = intPtr.GetParallel(); AssertRequiresReadOrWriteAccess( intPtr, parallel.Decrement); } }
public void ParallelAddOffsetsValue() { using (NativeIntPtr intPtr = new NativeIntPtr(Allocator.Temp, 123)) { NativeIntPtr.Parallel parallel = intPtr.GetParallel(); parallel.Add(5); Assert.That(intPtr.Value, Is.EqualTo(128)); parallel.Add(-15); Assert.That(intPtr.Value, Is.EqualTo(113)); } }