22using System . Numerics ;
33using ACE . Server . Physics ;
44using ACE . Server . Physics . Animation ;
5- using ACE . Server . Physics . Collision ;
65using Microsoft . VisualStudio . TestTools . UnitTesting ;
76
7+ [ assembly: Parallelize ]
8+
89namespace ACE . Server . Tests . Physics
910{
1011 [ TestClass ]
@@ -20,11 +21,11 @@ public void Sphere_Intersection()
2021 var sphereNonCollide = new Sphere ( new Vector3 ( 10 , 10 , 10 ) , 3.0f ) ;
2122 var sphereInside = new Sphere ( new Vector3 ( 1 , 1 , 1 ) , 1.0f ) ;
2223
23- Assert . AreEqual ( sphere . Intersects ( sphereCollide ) , true ) ;
24- Assert . AreEqual ( sphere . Intersects ( sphereCloseCall ) , false ) ;
25- Assert . AreEqual ( sphere . Intersects ( sphereTouching ) , false ) ;
26- Assert . AreEqual ( sphere . Intersects ( sphereNonCollide ) , false ) ;
27- Assert . AreEqual ( sphere . Intersects ( sphereInside ) , true ) ;
24+ Assert . IsTrue ( sphere . Intersects ( sphereCollide ) ) ;
25+ Assert . IsFalse ( sphere . Intersects ( sphereCloseCall ) ) ;
26+ Assert . IsFalse ( sphere . Intersects ( sphereTouching ) ) ;
27+ Assert . IsFalse ( sphere . Intersects ( sphereNonCollide ) ) ;
28+ Assert . IsTrue ( sphere . Intersects ( sphereInside ) ) ;
2829 }
2930
3031 [ TestMethod ]
@@ -36,15 +37,15 @@ public void Sphere_FindTimeOfCollision()
3637 var radSum = 20.0f ;
3738
3839 var time = Sphere . FindTimeOfCollision ( movement , otherSpherePosition , radSum ) ;
39- Assert . IsTrue ( time - 0.38452994616207481f < PhysicsGlobals . EPSILON ) ;
40+ Assert . IsLessThan ( PhysicsGlobals . EPSILON , time - 0.38452994616207481f ) ;
4041
4142 otherSpherePosition = new Vector3 ( 50 , 60 , 60 ) ;
4243 time = Sphere . FindTimeOfCollision ( movement , otherSpherePosition , radSum ) ;
43- Assert . IsTrue ( time - 0.46125741132772069f < PhysicsGlobals . EPSILON ) ;
44+ Assert . IsLessThan ( PhysicsGlobals . EPSILON , time - 0.46125741132772069f ) ;
4445
4546 otherSpherePosition = new Vector3 ( 30 , 42 , 63 ) ;
4647 time = Sphere . FindTimeOfCollision ( movement , otherSpherePosition , radSum ) ;
47- Assert . IsTrue ( time == - 1.0f ) ;
48+ Assert . AreEqual ( - 1.0f , time ) ;
4849 }
4950
5051 [ TestMethod ]
@@ -90,21 +91,21 @@ public void Sphere_CollideWithPoint()
9091 var sphereNum = 0 ;
9192
9293 var transitionState = sphere . CollideWithPoint ( transition , checkPos , radsum , sphereNum ) ;
93- Assert . IsTrue ( transitionState == TransitionState . Collided ) ;
94+ Assert . AreEqual ( TransitionState . Collided , transitionState ) ;
9495
9596 transition . ObjectInfo . State |= ObjectInfoState . PerfectClip ;
9697 transitionState = sphere . CollideWithPoint ( transition , checkPos , radsum , sphereNum ) ;
97- Assert . IsTrue ( transitionState == TransitionState . Collided ) ;
98+ Assert . AreEqual ( TransitionState . Collided , transitionState ) ;
9899
99100 // should redirect to location not currently in path
100101 checkPos . Center = new Vector3 ( 30 , 30 , 30 ) ;
101102 transitionState = sphere . CollideWithPoint ( transition , checkPos , radsum , sphereNum ) ;
102- Assert . IsTrue ( transitionState == TransitionState . Collided ) ;
103+ Assert . AreEqual ( TransitionState . Collided , transitionState ) ;
103104
104105 // not enough distance to make it this time
105106 transition . SpherePath . GlobalCurrCenter [ 0 ] = new Sphere ( new Vector3 ( 1 , 1 , 1 ) , 5.0f ) ;
106107 transitionState = sphere . CollideWithPoint ( transition , checkPos , radsum , sphereNum ) ;
107- Assert . IsTrue ( transitionState == TransitionState . Collided ) ;
108+ Assert . AreEqual ( TransitionState . Collided , transitionState ) ;
108109 }
109110
110111 [ TestMethod ]
@@ -152,7 +153,7 @@ public void Sphere_IntersectsSphere_Inner(Sphere sphere, Transition transition,
152153 transition . SpherePath . GlobalSphere [ 0 ] = sphereNonCollide ;
153154 SetCenter ( transition ) ;
154155 var transitionState = sphere . IntersectsSphere ( transition , false ) ;
155- Assert . AreEqual ( transitionState , TransitionState . OK ) ;
156+ Assert . AreEqual ( TransitionState . OK , transitionState ) ;
156157
157158 // test collision
158159 transition . SpherePath . GlobalSphere [ 0 ] = sphereCollide ;
@@ -190,13 +191,13 @@ public void Sphere_LandOnSphere()
190191
191192 // test collision
192193 var transitionState = sphere . LandOnSphere ( transition ) ;
193- Assert . AreEqual ( transitionState , TransitionState . Adjusted ) ;
194+ Assert . AreEqual ( TransitionState . Adjusted , transitionState ) ;
194195
195196 // test adjusted
196197 transition . SpherePath . GlobalCurrCenter [ 0 ] = new Sphere ( new Vector3 ( 0 , 0 , 0.0001f ) , 5.0f ) ;
197198 transitionState = sphere . LandOnSphere ( transition ) ;
198- Assert . AreEqual ( transitionState , TransitionState . Collided ) ;
199- Assert . AreEqual ( transition . SpherePath . Collide , true ) ;
199+ Assert . AreEqual ( TransitionState . Collided , transitionState ) ;
200+ Assert . IsTrue ( transition . SpherePath . Collide ) ;
200201 }
201202
202203 //[TestMethod]
@@ -227,7 +228,7 @@ public void Sphere_StepSphereDown()
227228 var checkPos = new Sphere ( ) ;
228229
229230 var transitionState = sphere . StepSphereDown ( transition , checkPos , ref disp , sphere . Radius * 2.0f ) ;
230- Assert . AreEqual ( transitionState , TransitionState . Collided ) ;
231+ Assert . AreEqual ( TransitionState . Collided , transitionState ) ;
231232 }
232233
233234 [ TestMethod ]
@@ -239,13 +240,13 @@ public void Sphere_SlideSphere()
239240 var transition = new Transition ( ) ;
240241
241242 var transitionState = sphere . SlideSphere ( transition , ref collisionNormal , Vector3 . Zero ) ;
242- Assert . AreEqual ( transitionState , TransitionState . Slid ) ;
243+ Assert . AreEqual ( TransitionState . Slid , transitionState ) ;
243244
244245 transition . CollisionInfo . LastKnownContactPlaneValid = true ;
245246 transition . CollisionInfo . LastKnownContactPlane = new Plane ( new Vector3 ( 0 , 0 , 1 ) , 0 ) ;
246247
247248 transitionState = sphere . SlideSphere ( transition , ref collisionNormal , Vector3 . Zero ) ;
248- Assert . AreEqual ( transitionState , TransitionState . OK ) ;
249+ Assert . AreEqual ( TransitionState . OK , transitionState ) ;
249250 }
250251 }
251252}
0 commit comments