From bbf47e84af60710f09944fa345a5f72978638c5e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 23 Mar 2009 14:39:12 +0100 Subject: [PATCH] SimpleBroadPhase: Refactored tests a bit. --- test/net/habraun/sd/SimpleBroadPhaseTest.scala | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/net/habraun/sd/SimpleBroadPhaseTest.scala b/test/net/habraun/sd/SimpleBroadPhaseTest.scala index 702af78..7b18d9a 100644 --- a/test/net/habraun/sd/SimpleBroadPhaseTest.scala +++ b/test/net/habraun/sd/SimpleBroadPhaseTest.scala @@ -27,10 +27,11 @@ import org.junit.Assert._ class SimpleBroadPhaseTest { - @Test - def verifyIsBroadPhase { - val broadPhase = new SimpleBroadPhase - assertTrue(broadPhase.isInstanceOf[BroadPhase]) + var broadPhase: BroadPhase = null + + @Before + def setup { + broadPhase = new SimpleBroadPhase } @@ -39,7 +40,7 @@ class SimpleBroadPhaseTest { def buildPairsFromTwoBodies { val b1 = new Body val b2 = new Body - val broadPhase: BroadPhase = new SimpleBroadPhase + assertEquals((b1, b2)::Nil, broadPhase.detectPossibleCollisions(b1::b2::Nil)) } @@ -50,9 +51,11 @@ class SimpleBroadPhaseTest { val b1 = new Body val b2 = new Body val b3 = new Body - val broadPhase: BroadPhase = new SimpleBroadPhase + val expectedPairs = (b1, b2)::(b1, b3)::(b2, b3)::Nil + val actualPairs = broadPhase.detectPossibleCollisions(b1::b2::b3::Nil) + assertEquals(expectedPairs, actualPairs) } } -- 2.11.4.GIT