| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- //using System;
- //using MonoGame.Extended.Particles;
- //using Xunit;
- //namespace MonoGame.Extended.Tests.Particles
- //{
- //
- // public class ParticleBufferTests
- // {
- // public class AvailableProperty
- // {
- // [Fact]
- // public void WhenNoParticlesReleased_ReturnsBufferSize()
- // {
- // var subject = new ParticleBuffer(100);
- // Assert.Equal(subject.Available, 100);
- // }
- // [Fact]
- // public void WhenSomeParticlesReleased_ReturnsAvailableCount()
- // {
- // var subject = new ParticleBuffer(100);
- // subject.Release(10);
- // Assert.Equal(subject.Available, 90);
- // }
- // [Fact]
- // public void WhenAllParticlesReleased_ReturnsZero()
- // {
- // var subject = new ParticleBuffer(100);
- // subject.Release(100);
- // Assert.Equal(subject.Available, 0);
- // }
- // }
- // public class CountProperty
- // {
- // [Fact]
- // public void WhenNoParticlesReleased_ReturnsZero()
- // {
- // var subject = new ParticleBuffer(100);
- // Assert.Equal(subject.Count, 0);
- // }
- // [Fact]
- // public void WhenSomeParticlesReleased_ReturnsCount()
- // {
- // var subject = new ParticleBuffer(100);
- // subject.Release(10);
- // Assert.Equal(subject.Count, 10);
- // }
- // [Fact]
- // public void WhenAllParticlesReleased_ReturnsZero()
- // {
- // var subject = new ParticleBuffer(100);
- // subject.Release(100);
- // Assert.Equal(subject.Count, 100);
- // }
- // }
- // public class ReleaseMethod
- // {
- // [Fact]
- // public void WhenPassedReasonableQuantity_ReturnsNumberReleased()
- // {
- // var subject = new ParticleBuffer(100);
- // var count = subject.Release(50);
- // Assert.Equal(count.Total, 50);
- // }
- // [Fact]
- // public void WhenPassedImpossibleQuantity_ReturnsNumberActuallyReleased()
- // {
- // var subject = new ParticleBuffer(100);
- // var count = subject.Release(200);
- // Assert.Equal(count.Total, 100);
- // }
- // }
- // public class ReclaimMethod
- // {
- // [Fact]
- // public void WhenPassedReasonableNumber_ReclaimsParticles()
- // {
- // var subject = new ParticleBuffer(100);
- // subject.Release(100);
- // Assert.Equal(subject.Count, 100);
- // subject.Reclaim(50);
- // Assert.Equal(subject.Count, 50);
- // }
- // }
- // //public class CopyToMethod
- // //{
- // // [Fact]
- // // public void WhenBufferIsSequential_CopiesParticlesInOrder()
- // // {
- // // unsafe
- // // {
- // // var subject = new ParticleBuffer(10);
- // // var iterator = subject.Release(5);
- // // do
- // // {
- // // var particle = iterator.Next();
- // // particle->Age = 1f;
- // // }
- // // while (iterator.HasNext);
- // // var destination = new Particle[10];
- // // fixed (Particle* buffer = destination)
- // // {
- // // subject.CopyTo((IntPtr)buffer);
- // // }
- // // Assert.Equal(destination[0].Age, 1f, 0.0001);
- // // Assert.Equal(destination[1].Age, 1f, 0.0001);
- // // Assert.Equal(destination[2].Age, 1f, 0.0001);
- // // Assert.Equal(destination[3].Age, 1f, 0.0001);
- // // Assert.Equal(destination[4].Age, 1f, 0.0001);
- // // }
- // // }
- // //}
- // //public class CopyToReverseMethod
- // //{
- // // [Fact]
- // // public void WhenBufferIsSequential_CopiesParticlesInReverseOrder()
- // // {
- // // unsafe
- // // {
- // // var subject = new ParticleBuffer(10);
- // // var iterator = subject.Release(5);
-
- // // do
- // // {
- // // var particle = iterator.Next();
- // // particle->Age = 1f;
- // // }
- // // while (iterator.HasNext);
- // // var destination = new Particle[10];
- // // fixed (Particle* buffer = destination)
- // // {
- // // subject.CopyToReverse((IntPtr)buffer);
- // // }
- // // Assert.Equal(destination[0].Age, 1f, 0.0001);
- // // Assert.Equal(destination[1].Age, 1f, 0.0001);
- // // Assert.Equal(destination[2].Age, 1f, 0.0001);
- // // Assert.Equal(destination[3].Age, 1f, 0.0001);
- // // Assert.Equal(destination[4].Age, 1f, 0.0001);
- // // }
- // // }
- // //}
- // public class DisposeMethod
- // {
- // [Fact]
- // public void IsIdempotent()
- // {
- // var subject = new ParticleBuffer(100);
- // subject.Dispose();
- // subject.Dispose();
- // }
- // }
- // }
- //}
|