Stop bullets when they hit walls
This commit is contained in:
+14
-1
@@ -1,12 +1,13 @@
|
||||
--import Test.HUnit
|
||||
import Test.Tasty
|
||||
import Test.Tasty.QuickCheck
|
||||
import qualified Test.Tasty.QuickCheck as QC
|
||||
import Test.Tasty.HUnit
|
||||
import Dodge.Room.CheckConsistency
|
||||
import Geometry
|
||||
|
||||
import Dodge.LevelGen.StaticWalls
|
||||
import Geometry
|
||||
import Data.Maybe
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain $
|
||||
@@ -14,6 +15,11 @@ main = defaultMain $
|
||||
[testGroup "Geometry tests" geometryTests]
|
||||
|
||||
geometryTests =
|
||||
[ testGroup "(HUnit)" geometryUnitTests
|
||||
, testGroup "(QuickCheck)" geometryQuickCheckTests
|
||||
]
|
||||
|
||||
geometryUnitTests =
|
||||
[ testCase "intersectSegSegTest cross intersect" $
|
||||
intersectSegSegTest (V2 1 0) (V2 1 2) (V2 0 1) (V2 2 1)
|
||||
@?= True
|
||||
@@ -46,6 +52,13 @@ geometryTests =
|
||||
@?= False
|
||||
]
|
||||
|
||||
geometryQuickCheckTests =
|
||||
[ QC.testProperty "intersectSegSeg--intersectSegSegTest" $
|
||||
\(x1,y1,x2,y2,x3,y3,x4,y4) ->
|
||||
isJust (intersectSegSeg (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4))
|
||||
== intersectSegSegTest (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
]
|
||||
|
||||
--nextPair :: Eq a => (a,a) -> [(a,a)] -> [(a,a)]
|
||||
--nextPair (_,y) = filter (\(x,_) -> x == y)
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user