Setup basic tests for wall carving
This commit is contained in:
+33
-1
@@ -1,4 +1,36 @@
|
||||
import Test.QuickCheck
|
||||
|
||||
import Dodge.LevelGen.StaticWalls
|
||||
import Geometry
|
||||
|
||||
main :: IO ()
|
||||
main = putStrLn "Test suite not yet implemented"
|
||||
main = do
|
||||
putStrLn "Running tests:"
|
||||
quickCheck prop_looping
|
||||
|
||||
nextPair :: Eq a => (a,a) -> [(a,a)] -> [(a,a)]
|
||||
nextPair (_,y) = filter (\(x,_) -> x == y)
|
||||
|
||||
isLooping :: Eq a => [(a,a)] -> Bool
|
||||
isLooping xs = all (( == 1) . length . flip nextPair xs) xs
|
||||
|
||||
polygonStrictlyConvex :: [Point2] -> Bool
|
||||
polygonStrictlyConvex ps = True
|
||||
|
||||
--prop_looping :: [Point2] -> [WallP] -> Bool
|
||||
|
||||
prop_looping = forAllShrink genTris shrinkTris $ \tris ->
|
||||
isLooping $ foldr cutWalls' [] tris
|
||||
|
||||
shrinkTris (x:xs) = xs : map (x :) (shrink xs)
|
||||
|
||||
genTri = zip <$> trip <*> trip
|
||||
where
|
||||
trip = vectorOf 3 $ choose (-500,500::Float)
|
||||
|
||||
genTris = listOf genTri
|
||||
|
||||
--extractLoops :: Eq a => [(a,a)] -> [[(a,a)]]
|
||||
--extractLoops [] = []
|
||||
--extractLoops (x:xs) =
|
||||
|
||||
|
||||
Reference in New Issue
Block a user