ParticleBufferTests.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. //using System;
  2. //using MonoGame.Extended.Particles;
  3. //using Xunit;
  4. //namespace MonoGame.Extended.Tests.Particles
  5. //{
  6. //
  7. // public class ParticleBufferTests
  8. // {
  9. // public class AvailableProperty
  10. // {
  11. // [Fact]
  12. // public void WhenNoParticlesReleased_ReturnsBufferSize()
  13. // {
  14. // var subject = new ParticleBuffer(100);
  15. // Assert.Equal(subject.Available, 100);
  16. // }
  17. // [Fact]
  18. // public void WhenSomeParticlesReleased_ReturnsAvailableCount()
  19. // {
  20. // var subject = new ParticleBuffer(100);
  21. // subject.Release(10);
  22. // Assert.Equal(subject.Available, 90);
  23. // }
  24. // [Fact]
  25. // public void WhenAllParticlesReleased_ReturnsZero()
  26. // {
  27. // var subject = new ParticleBuffer(100);
  28. // subject.Release(100);
  29. // Assert.Equal(subject.Available, 0);
  30. // }
  31. // }
  32. // public class CountProperty
  33. // {
  34. // [Fact]
  35. // public void WhenNoParticlesReleased_ReturnsZero()
  36. // {
  37. // var subject = new ParticleBuffer(100);
  38. // Assert.Equal(subject.Count, 0);
  39. // }
  40. // [Fact]
  41. // public void WhenSomeParticlesReleased_ReturnsCount()
  42. // {
  43. // var subject = new ParticleBuffer(100);
  44. // subject.Release(10);
  45. // Assert.Equal(subject.Count, 10);
  46. // }
  47. // [Fact]
  48. // public void WhenAllParticlesReleased_ReturnsZero()
  49. // {
  50. // var subject = new ParticleBuffer(100);
  51. // subject.Release(100);
  52. // Assert.Equal(subject.Count, 100);
  53. // }
  54. // }
  55. // public class ReleaseMethod
  56. // {
  57. // [Fact]
  58. // public void WhenPassedReasonableQuantity_ReturnsNumberReleased()
  59. // {
  60. // var subject = new ParticleBuffer(100);
  61. // var count = subject.Release(50);
  62. // Assert.Equal(count.Total, 50);
  63. // }
  64. // [Fact]
  65. // public void WhenPassedImpossibleQuantity_ReturnsNumberActuallyReleased()
  66. // {
  67. // var subject = new ParticleBuffer(100);
  68. // var count = subject.Release(200);
  69. // Assert.Equal(count.Total, 100);
  70. // }
  71. // }
  72. // public class ReclaimMethod
  73. // {
  74. // [Fact]
  75. // public void WhenPassedReasonableNumber_ReclaimsParticles()
  76. // {
  77. // var subject = new ParticleBuffer(100);
  78. // subject.Release(100);
  79. // Assert.Equal(subject.Count, 100);
  80. // subject.Reclaim(50);
  81. // Assert.Equal(subject.Count, 50);
  82. // }
  83. // }
  84. // //public class CopyToMethod
  85. // //{
  86. // // [Fact]
  87. // // public void WhenBufferIsSequential_CopiesParticlesInOrder()
  88. // // {
  89. // // unsafe
  90. // // {
  91. // // var subject = new ParticleBuffer(10);
  92. // // var iterator = subject.Release(5);
  93. // // do
  94. // // {
  95. // // var particle = iterator.Next();
  96. // // particle->Age = 1f;
  97. // // }
  98. // // while (iterator.HasNext);
  99. // // var destination = new Particle[10];
  100. // // fixed (Particle* buffer = destination)
  101. // // {
  102. // // subject.CopyTo((IntPtr)buffer);
  103. // // }
  104. // // Assert.Equal(destination[0].Age, 1f, 0.0001);
  105. // // Assert.Equal(destination[1].Age, 1f, 0.0001);
  106. // // Assert.Equal(destination[2].Age, 1f, 0.0001);
  107. // // Assert.Equal(destination[3].Age, 1f, 0.0001);
  108. // // Assert.Equal(destination[4].Age, 1f, 0.0001);
  109. // // }
  110. // // }
  111. // //}
  112. // //public class CopyToReverseMethod
  113. // //{
  114. // // [Fact]
  115. // // public void WhenBufferIsSequential_CopiesParticlesInReverseOrder()
  116. // // {
  117. // // unsafe
  118. // // {
  119. // // var subject = new ParticleBuffer(10);
  120. // // var iterator = subject.Release(5);
  121. // // do
  122. // // {
  123. // // var particle = iterator.Next();
  124. // // particle->Age = 1f;
  125. // // }
  126. // // while (iterator.HasNext);
  127. // // var destination = new Particle[10];
  128. // // fixed (Particle* buffer = destination)
  129. // // {
  130. // // subject.CopyToReverse((IntPtr)buffer);
  131. // // }
  132. // // Assert.Equal(destination[0].Age, 1f, 0.0001);
  133. // // Assert.Equal(destination[1].Age, 1f, 0.0001);
  134. // // Assert.Equal(destination[2].Age, 1f, 0.0001);
  135. // // Assert.Equal(destination[3].Age, 1f, 0.0001);
  136. // // Assert.Equal(destination[4].Age, 1f, 0.0001);
  137. // // }
  138. // // }
  139. // //}
  140. // public class DisposeMethod
  141. // {
  142. // [Fact]
  143. // public void IsIdempotent()
  144. // {
  145. // var subject = new ParticleBuffer(100);
  146. // subject.Dispose();
  147. // subject.Dispose();
  148. // }
  149. // }
  150. // }
  151. //}