示例#1
0
        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));
            }
        }
示例#2
0
 public void ParallelAddRequiresReadAccess()
 {
     using (NativeIntPtr intPtr = new NativeIntPtr(Allocator.Temp))
     {
         NativeIntPtr.Parallel parallel = intPtr.GetParallel();
         AssertRequiresReadOrWriteAccess(
             intPtr,
             () => parallel.Add(10));
     }
 }
示例#3
0
 public void ParallelDecrementRequiresReadAccess()
 {
     using (NativeIntPtr intPtr = new NativeIntPtr(Allocator.Temp))
     {
         NativeIntPtr.Parallel parallel = intPtr.GetParallel();
         AssertRequiresReadOrWriteAccess(
             intPtr,
             parallel.Decrement);
     }
 }
示例#4
0
        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));
            }
        }