Check whether tests compile in ghcid

This commit is contained in:
2026-03-29 15:50:58 +01:00
parent 7b9635fe53
commit d278083947
11 changed files with 95 additions and 84 deletions
+1
View File
@@ -1 +1,2 @@
:set prompt ">" :set prompt ">"
:load test/Spec.hs
+1 -1
View File
@@ -1 +1 @@
--command "stack ghci --main-is loop:exe:dodge" --command "stack ghci --test --main-is loop:test:loop-test --ghci-options=-fobject-code"
+1
View File
@@ -8,3 +8,4 @@ log/*
generated/* generated/*
tags tags
ghcidOutput ghcidOutput
.ghcid.bak
+30 -38
View File
@@ -1,4 +1,5 @@
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
module Dodge.Creature.HandPos ( module Dodge.Creature.HandPos (
equipSitePQ, equipSitePQ,
translatePointToLeftHand, translatePointToLeftHand,
@@ -13,16 +14,16 @@ module Dodge.Creature.HandPos (
rightHandPQ, rightHandPQ,
) where ) where
import Dodge.Data.Equipment.Misc
import qualified Quaternion as Q
import Control.Lens import Control.Lens
import Dodge.Creature.Test import Dodge.Creature.Test
import Dodge.Data.Creature import Dodge.Data.Creature
import Dodge.Data.Equipment.Misc
import Geometry import Geometry
import qualified Quaternion as Q
import ShapePicture import ShapePicture
translateToES :: Creature -> EquipSite -> Point3 -> Point3 translateToES :: Creature -> EquipSite -> Point3 -> Point3
translateToES cr es p = fst (equipSitePQ es cr `Q.comp` (p,Q.qID)) translateToES cr es p = fst (equipSitePQ es cr `Q.comp` (p, Q.qID))
equipSitePQ :: EquipSite -> Creature -> Point3Q equipSitePQ :: EquipSite -> Creature -> Point3Q
equipSitePQ = \case equipSitePQ = \case
@@ -31,24 +32,26 @@ equipSitePQ = \case
OnHead -> headPQ OnHead -> headPQ
OnChest -> chestPQ OnChest -> chestPQ
OnBack -> backPQ OnBack -> backPQ
OnLeftLeg -> leftLegPQ OnLeftLeg -> legPQ LeftForward
OnRightLeg -> rightLegPQ OnRightLeg -> legPQ RightForward
translatePointToRightHand :: Creature -> Point3 -> Point3 translatePointToRightHand :: Creature -> Point3 -> Point3
translatePointToRightHand cr p = fst (rightHandPQ cr `Q.comp` (p,Q.qID)) translatePointToRightHand cr p = fst (rightHandPQ cr `Q.comp` (p, Q.qID))
handWalkingPos :: FootForward -> Float -> Creature -> Point3 handWalkingPos :: FootForward -> Float -> Creature -> Point3
handWalkingPos b off cr = case cr ^. crStance . carriage of handWalkingPos b off cr = case cr ^. crStance . carriage of
Walking sa ff -> Walking sa ff ->
let slen = cr ^. crStance . strideLength let slen = cr ^. crStance . strideLength
f i | ff == b = 8 * (slen - i) / slen f i
| ff == b = 8 * (slen - i) / slen
| otherwise = 8 * i / slen | otherwise = 8 * i / slen
in V3 (f sa) off 12 in V3 (f sa) off 12
Falling sa ff -> Falling sa ff ->
let slen = cr ^. crStance . strideLength let slen = cr ^. crStance . strideLength
f i | ff == b = 8 * (slen - i) / slen f i
| ff == b = 8 * (slen - i) / slen
| otherwise = 8 * i / slen | otherwise = 8 * i / slen
in V3 (f sa) off 20 in V3 (f sa) off 20
Floating -> V3 0 off 12 Floating -> V3 0 off 12
Flying -> V3 0 off 12 Flying -> V3 0 off 12
Boosting _ -> V3 0 off 12 Boosting _ -> V3 0 off 12
@@ -56,7 +59,7 @@ handWalkingPos b off cr = case cr ^. crStance . carriage of
rightHandPQ :: Creature -> Point3Q rightHandPQ :: Creature -> Point3Q
rightHandPQ cr rightHandPQ cr
| oneH cr = (V3 11 (-3) 20, Q.qID) | oneH cr = (V3 11 (-3) 20, Q.qID)
| twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 4 (-10) 0,Q.qID) | twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 4 (-10) 0, Q.qID)
| twoFlat cr = (V3 4 (-8) 12, Q.qID) | twoFlat cr = (V3 4 (-8) 12, Q.qID)
| otherwise = (handWalkingPos LeftForward (-8) cr, Q.qID) | otherwise = (handWalkingPos LeftForward (-8) cr, Q.qID)
@@ -74,7 +77,7 @@ leftHandPQ cr
| otherwise = (handWalkingPos RightForward 8 cr, Q.qID) | otherwise = (handWalkingPos RightForward 8 cr, Q.qID)
translatePointToLeftHand :: Creature -> Point3 -> Point3 translatePointToLeftHand :: Creature -> Point3 -> Point3
translatePointToLeftHand cr p = fst (leftHandPQ cr `Q.comp` (p,Q.qID)) translatePointToLeftHand cr p = fst (leftHandPQ cr `Q.comp` (p, Q.qID))
translateToLeftHand :: Creature -> SPic -> SPic translateToLeftHand :: Creature -> SPic -> SPic
translateToLeftHand = overPosSP . translatePointToLeftHand translateToLeftHand = overPosSP . translatePointToLeftHand
@@ -82,27 +85,19 @@ translateToLeftHand = overPosSP . translatePointToLeftHand
leftWristPQ :: Creature -> Point3Q leftWristPQ :: Creature -> Point3Q
leftWristPQ cr = leftHandPQ cr `Q.comp` (V3 0 4 (-4), Q.qID) leftWristPQ cr = leftHandPQ cr `Q.comp` (V3 0 4 (-4), Q.qID)
leftLegPQ :: Creature -> Point3Q
leftLegPQ cr = Q.comp (0,Q.qz (_crMvDir cr - _crDir cr))
(V3 x off 0,Q.qID)
where
x = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> f sa
Just (Walking sa RightForward) -> - f sa
Just (Falling sa LeftForward) -> f sa
Just (Falling sa RightForward) -> - f sa
_ -> 0
off = 5
sLen = _strideLength $ _crStance cr
f i = 8 * (sLen - i) / sLen
translateToLeftLeg :: Creature -> SPic -> SPic translateToLeftLeg :: Creature -> SPic -> SPic
translateToLeftLeg cr = overPosSP (\p -> fst (leftLegPQ cr `Q.comp` (p,Q.qID))) translateToLeftLeg cr = overPosSP (\p -> fst (legPQ LeftForward cr `Q.comp` (p, Q.qID)))
rightLegPQ :: Creature -> Point3Q legPQ :: FootForward -> Creature -> Point3Q
rightLegPQ cr = Q.comp (0,Q.qz (_crMvDir cr - _crDir cr)) legPQ ff = case ff of
(V3 x off 0,Q.qID) LeftForward -> legPQ' id
RightForward -> legPQ' negate
legPQ' :: (Float -> Float) -> Creature -> Point3Q
legPQ' g cr =
Q.comp
(0, Q.qz (_crMvDir cr - _crDir cr))
(V3 x (g off) 0, Q.qID)
where where
x = case cr ^? crStance . carriage of x = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> -f sa Just (Walking sa LeftForward) -> -f sa
@@ -112,10 +107,10 @@ rightLegPQ cr = Q.comp (0,Q.qz (_crMvDir cr - _crDir cr))
_ -> 0 _ -> 0
off = -5 off = -5
sLen = _strideLength $ _crStance cr sLen = _strideLength $ _crStance cr
f i = 8 * (sLen - i) / sLen f i = g 8 * (sLen - i) / sLen
translateToRightLeg :: Creature -> SPic -> SPic translateToRightLeg :: Creature -> SPic -> SPic
translateToRightLeg cr = overPosSP (\p -> fst (rightLegPQ cr `Q.comp` (p,Q.qID))) translateToRightLeg cr = overPosSP (\p -> fst (legPQ RightForward cr `Q.comp` (p, Q.qID)))
headPQ :: Creature -> Point3Q headPQ :: Creature -> Point3Q
headPQ cr headPQ cr
@@ -123,11 +118,8 @@ headPQ cr
| oneH cr = (V3 0 0 20, Q.qz 0.5) `Q.comp` (V3 2.5 0 0, Q.qz (-0.5)) | oneH cr = (V3 0 0 20, Q.qz 0.5) `Q.comp` (V3 2.5 0 0, Q.qz (-0.5))
| otherwise = (V3 2.5 0 20, Q.qID) | otherwise = (V3 2.5 0 20, Q.qID)
--translatePointToHead :: IM.IntMap Item -> Creature -> Point3 -> Point3
--translatePointToHead m cr p = fst (headPQ cr `Q.comp` (p,Q.qID))
chestPQ :: Creature -> Point3Q chestPQ :: Creature -> Point3Q
chestPQ cr = backPQ cr `Q.comp` (0,Q.qz pi) chestPQ cr = backPQ cr `Q.comp` (0, Q.qz pi)
backPQ :: Creature -> Point3Q backPQ :: Creature -> Point3Q
backPQ cr backPQ cr
+1 -1
View File
@@ -20,7 +20,7 @@ data Stance = Stance
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Carriage data Carriage
= Walking {_strideAmount :: Float, _currentFoot :: FootForward} = Walking {_strideAmount :: Float, _footForward :: FootForward}
| Floating | Floating
| Flying | Flying
| Boosting Point2 | Boosting Point2
+1
View File
@@ -28,6 +28,7 @@ updateDoor dr w = case dr ^. drUpdate of
, foldl' (doDoorMount (doDoorLerp dr (dr ^. drLerp))) w (dr ^. drMounts) , foldl' (doDoorMount (doDoorLerp dr (dr ^. drLerp))) w (dr ^. drMounts)
) )
-- could filter these HERE rather than later?
doDoorMount :: Point2A -> World -> MountedObject -> World doDoorMount :: Point2A -> World -> MountedObject -> World
doDoorMount pa w = \case doDoorMount pa w = \case
MountedLight p r c -> MountedLight p r c ->
+4 -3
View File
@@ -7,6 +7,7 @@ module Dodge.Item.HeldOffset (
handHandleOrient, handHandleOrient,
) where ) where
import Linear
import Dodge.Creature.HandPos import Dodge.Creature.HandPos
import Dodge.Data.AimStance import Dodge.Data.AimStance
import Dodge.Data.ComposedItem import Dodge.Data.ComposedItem
@@ -26,9 +27,7 @@ turretItemOffset it tu mc =
. transToHandle it . transToHandle it
transToHandle :: Item -> Point3 -> Point3 transToHandle :: Item -> Point3 -> Point3
transToHandle itm = (-.-.- V3 x y 0) transToHandle itm = (-.-.- (0 & _xy .~ handlePos itm))
where
V2 x y = handlePos itm
handleOrient :: LocationDT CItem -> Point3Q handleOrient :: LocationDT CItem -> Point3Q
handleOrient loc = case loc ^. locDT . dtValue . _1 . itType of handleOrient loc = case loc ^. locDT . dtValue . _1 . itType of
@@ -68,6 +67,8 @@ strideRot :: Creature -> Float
strideRot cr = case cr ^? crStance . carriage of strideRot cr = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x Just (Walking x LeftForward) -> f x
Just (Walking x RightForward) -> - f x Just (Walking x RightForward) -> - f x
Just (Falling x LeftForward) -> f x
Just (Falling x RightForward) -> - f x
_ -> 0 _ -> 0
where where
f i = 0.1 * (sLen - i) / sLen f i = 0.1 * (sLen - i) / sLen
+3
View File
@@ -55,6 +55,9 @@ tutAnoTree = do
foldMTRS foldMTRS
[ tToBTree "TutStartRez" . return . cleatOnward <$> tutRezBox [ tToBTree "TutStartRez" . return . cleatOnward <$> tutRezBox
, corDoor , corDoor
, lasRunYinYang
, corDoor
, corDoor
, tToBTree "slowCrush" . return . cleatOnward <$> pushCaverns , tToBTree "slowCrush" . return . cleatOnward <$> pushCaverns
, corDoor , corDoor
, chasmSpitTerminal , chasmSpitTerminal
+4 -2
View File
@@ -59,9 +59,11 @@ angleVV :: Point2 -> Point2 -> Float
{-# INLINE angleVV #-} {-# INLINE angleVV #-}
angleVV a b angleVV a b
| a == b = 0 | a == b = 0
| norm a == 0 = 0
| norm b == 0 = 0
| otherwise = | otherwise =
let ma = magV a let ma = norm a
mb = magV b mb = norm b
d = a `dotV` b d = a `dotV` b
in acos $ d / (ma * mb) in acos $ d / (ma * mb)
+29 -29
View File
@@ -2669,7 +2669,7 @@ axisInt src/Geometry/Intersect.hs 246;" f
azure src/Color.hs 49;" f azure src/Color.hs 49;" f
bQuadToF src/Geometry/Bezier.hs 37;" f bQuadToF src/Geometry/Bezier.hs 37;" f
bQuadToLine src/Geometry/Bezier.hs 30;" f bQuadToLine src/Geometry/Bezier.hs 30;" f
backPQ src/Dodge/Creature/HandPos.hs 126;" f backPQ src/Dodge/Creature/HandPos.hs 132;" f
backgroundSpaceS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 729;" f backgroundSpaceS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 729;" f
backpackCombinations src/Dodge/Combine/Combinations.hs 27;" f backpackCombinations src/Dodge/Combine/Combinations.hs 27;" f
backpackShape src/Dodge/Item/Draw/SPic.hs 188;" f backpackShape src/Dodge/Item/Draw/SPic.hs 188;" f
@@ -2834,7 +2834,7 @@ checkWallLeft src/Dodge/LevelGen/StaticWalls/Deprecated.hs 29;" f
checkWallRight src/Dodge/LevelGen/StaticWalls.hs 54;" f checkWallRight src/Dodge/LevelGen/StaticWalls.hs 54;" f
checkWallRight src/Dodge/LevelGen/StaticWalls/Deprecated.hs 59;" f checkWallRight src/Dodge/LevelGen/StaticWalls/Deprecated.hs 59;" f
chemFuelPouch src/Dodge/Item/Ammo.hs 81;" f chemFuelPouch src/Dodge/Item/Ammo.hs 81;" f
chestPQ src/Dodge/Creature/HandPos.hs 123;" f chestPQ src/Dodge/Creature/HandPos.hs 129;" f
chooseCursorBorders src/Dodge/Render/List.hs 141;" f chooseCursorBorders src/Dodge/Render/List.hs 141;" f
chooseEquipPosition src/Dodge/Inventory/RBList.hs 41;" f chooseEquipPosition src/Dodge/Inventory/RBList.hs 41;" f
chooseFootSound src/Dodge/Creature/State/WalkCycle.hs 35;" f chooseFootSound src/Dodge/Creature/State/WalkCycle.hs 35;" f
@@ -3491,7 +3491,7 @@ equipInfo src/Dodge/Item/Info.hs 140;" f
equipItemSPic src/Dodge/Item/Draw/SPic.hs 159;" f equipItemSPic src/Dodge/Item/Draw/SPic.hs 159;" f
equipPosition src/Dodge/Item/Draw.hs 38;" f equipPosition src/Dodge/Item/Draw.hs 38;" f
equipSiteInfo src/Dodge/Item/Info.hs 253;" f equipSiteInfo src/Dodge/Item/Info.hs 253;" f
equipSitePQ src/Dodge/Creature/HandPos.hs 28;" f equipSitePQ src/Dodge/Creature/HandPos.hs 27;" f
equipType src/Dodge/Data/EquipType.hs 10;" f equipType src/Dodge/Data/EquipType.hs 10;" f
equipmentDesignation src/Dodge/Inventory/RBList.hs 52;" f equipmentDesignation src/Dodge/Inventory/RBList.hs 52;" f
equipmentStrValue src/Dodge/Creature/Statistics.hs 56;" f equipmentStrValue src/Dodge/Creature/Statistics.hs 56;" f
@@ -3712,17 +3712,17 @@ halfHeight src/Dodge/Base/Window.hs 49;" f
halfWidth src/Dodge/Base/Window.hs 49;" f halfWidth src/Dodge/Base/Window.hs 49;" f
haltSound src/Dodge/SoundLogic.hs 38;" f haltSound src/Dodge/SoundLogic.hs 38;" f
hammerCheck src/Dodge/HeldUse.hs 67;" f hammerCheck src/Dodge/HeldUse.hs 67;" f
handHandleOrient src/Dodge/Item/HeldOffset.hs 58;" f handHandleOrient src/Dodge/Item/HeldOffset.hs 57;" f
handOrient src/Dodge/Item/HeldOffset.hs 40;" f handOrient src/Dodge/Item/HeldOffset.hs 39;" f
handWalkingPos src/Dodge/Creature/HandPos.hs 41;" f handWalkingPos src/Dodge/Creature/HandPos.hs 40;" f
handleEvent src/Dodge/Event.hs 27;" f handleEvent src/Dodge/Event.hs 27;" f
handleHotkeys src/Dodge/Creature/YourControl.hs 46;" f handleHotkeys src/Dodge/Creature/YourControl.hs 46;" f
handleKeyboardEvent src/Dodge/Event/Input.hs 23;" f handleKeyboardEvent src/Dodge/Event/Input.hs 23;" f
handleMouseButtonEvent src/Dodge/Event/Input.hs 59;" f handleMouseButtonEvent src/Dodge/Event/Input.hs 59;" f
handleMouseMotionEvent src/Dodge/Event/Input.hs 47;" f handleMouseMotionEvent src/Dodge/Event/Input.hs 47;" f
handleMouseWheelEvent src/Dodge/Event/Input.hs 54;" f handleMouseWheelEvent src/Dodge/Event/Input.hs 54;" f
handleOrient src/Dodge/Item/HeldOffset.hs 33;" f handleOrient src/Dodge/Item/HeldOffset.hs 32;" f
handlePos src/Dodge/Item/HeldOffset.hs 79;" f handlePos src/Dodge/Item/HeldOffset.hs 78;" f
handleResizeEvent src/Dodge/Event.hs 53;" f handleResizeEvent src/Dodge/Event.hs 53;" f
handleTextInput src/Dodge/Event/Input.hs 19;" f handleTextInput src/Dodge/Event/Input.hs 19;" f
handleWindowMoveEvent src/Dodge/Event.hs 44;" f handleWindowMoveEvent src/Dodge/Event.hs 44;" f
@@ -3737,7 +3737,7 @@ head src/DoubleStack.hs 14;" f
headLamp src/Dodge/Item/Equipment.hs 68;" f headLamp src/Dodge/Item/Equipment.hs 68;" f
headLampShape src/Dodge/Item/Draw/SPic.hs 423;" f headLampShape src/Dodge/Item/Draw/SPic.hs 423;" f
headMap src/Dodge/DoubleTree.hs 118;" f headMap src/Dodge/DoubleTree.hs 118;" f
headPQ src/Dodge/Creature/HandPos.hs 114;" f headPQ src/Dodge/Creature/HandPos.hs 120;" f
healS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 627;" f healS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 627;" f
healthAnalyserByDoor src/Dodge/Room/LasTurret.hs 108;" f healthAnalyserByDoor src/Dodge/Room/LasTurret.hs 108;" f
healthTest src/Dodge/Room/LasTurret.hs 130;" f healthTest src/Dodge/Room/LasTurret.hs 130;" f
@@ -3746,7 +3746,7 @@ heldAimStance src/Dodge/Item/AimStance.hs 27;" f
heldAimZoom src/Dodge/Update/Camera.hs 158;" f heldAimZoom src/Dodge/Update/Camera.hs 158;" f
heldEffect src/Dodge/HeldUse.hs 64;" f heldEffect src/Dodge/HeldUse.hs 64;" f
heldEffectMuzzles src/Dodge/HeldUse.hs 135;" f heldEffectMuzzles src/Dodge/HeldUse.hs 135;" f
heldHandlePos src/Dodge/Item/HeldOffset.hs 85;" f heldHandlePos src/Dodge/Item/HeldOffset.hs 84;" f
heldInfo src/Dodge/Item/Info.hs 92;" f heldInfo src/Dodge/Item/Info.hs 92;" f
heldItemAmmoSlots src/Dodge/Item/AmmoSlots.hs 20;" f heldItemAmmoSlots src/Dodge/Item/AmmoSlots.hs 20;" f
heldItemBulkiness src/Dodge/Creature/YourControl.hs 194;" f heldItemBulkiness src/Dodge/Creature/YourControl.hs 194;" f
@@ -4000,12 +4000,12 @@ leaveResetQuitTerminal src/Dodge/WorldEffect.hs 163;" f
led src/Dodge/Item/Held/Utility.hs 23;" f led src/Dodge/Item/Held/Utility.hs 23;" f
left src/DoubleStack.hs 16;" f left src/DoubleStack.hs 16;" f
leftChildList src/Dodge/Item/Grammar.hs 193;" f leftChildList src/Dodge/Item/Grammar.hs 193;" f
leftHandPQ src/Dodge/Creature/HandPos.hs 63;" f leftHandPQ src/Dodge/Creature/HandPos.hs 69;" f
leftIsParentCombine src/Dodge/Item/Grammar.hs 170;" f leftIsParentCombine src/Dodge/Item/Grammar.hs 170;" f
leftLegPQ src/Dodge/Creature/HandPos.hs 79;" f leftLegPQ src/Dodge/Creature/HandPos.hs 85;" f
leftPad src/Padding.hs 15;" f leftPad src/Padding.hs 15;" f
leftRightCombine src/Dodge/Item/Grammar.hs 205;" f leftRightCombine src/Dodge/Item/Grammar.hs 205;" f
leftWristPQ src/Dodge/Creature/HandPos.hs 76;" f leftWristPQ src/Dodge/Creature/HandPos.hs 82;" f
legsSPic src/Dodge/Item/Draw/SPic.hs 448;" f legsSPic src/Dodge/Item/Draw/SPic.hs 448;" f
lerpP2A src/Dodge/ShiftPoint.hs 14;" f lerpP2A src/Dodge/ShiftPoint.hs 14;" f
liShape src/Dodge/Placement/Instance/LightSource.hs 85;" f liShape src/Dodge/Placement/Instance/LightSource.hs 85;" f
@@ -4050,7 +4050,7 @@ locDTLeftmost src/Dodge/DoubleTree.hs 148;" f
locDTRightmost src/Dodge/DoubleTree.hs 151;" f locDTRightmost src/Dodge/DoubleTree.hs 151;" f
locGoHelp src/Dodge/DoubleTree.hs 166;" f locGoHelp src/Dodge/DoubleTree.hs 166;" f
locMuzzles src/Dodge/HeldUse.hs 149;" f locMuzzles src/Dodge/HeldUse.hs 149;" f
locOrient src/Dodge/Item/HeldOffset.hs 53;" f locOrient src/Dodge/Item/HeldOffset.hs 52;" f
locToTop src/Dodge/DoubleTree.hs 145;" f locToTop src/Dodge/DoubleTree.hs 145;" f
locUp' src/Dodge/DoubleTree.hs 132;" f locUp' src/Dodge/DoubleTree.hs 132;" f
lockInv src/Dodge/Inventory/Lock.hs 9;" f lockInv src/Dodge/Inventory/Lock.hs 9;" f
@@ -4724,12 +4724,12 @@ rhombus src/Polyhedra.hs 69;" f
rifle src/Dodge/Item/Held/Cane.hs 19;" f rifle src/Dodge/Item/Held/Cane.hs 19;" f
right src/DoubleStack.hs 16;" f right src/DoubleStack.hs 16;" f
rightChildList src/Dodge/Item/Grammar.hs 199;" f rightChildList src/Dodge/Item/Grammar.hs 199;" f
rightHandPQ src/Dodge/Creature/HandPos.hs 50;" f rightHandPQ src/Dodge/Creature/HandPos.hs 56;" f
rightIsParentCombine src/Dodge/Item/Grammar.hs 181;" f rightIsParentCombine src/Dodge/Item/Grammar.hs 181;" f
rightLegPQ src/Dodge/Creature/HandPos.hs 97;" f rightLegPQ src/Dodge/Creature/HandPos.hs 103;" f
rightPad src/Padding.hs 19;" f rightPad src/Padding.hs 19;" f
rightPadNoSquash src/Padding.hs 23;" f rightPadNoSquash src/Padding.hs 23;" f
rightWristPQ src/Dodge/Creature/HandPos.hs 60;" f rightWristPQ src/Dodge/Creature/HandPos.hs 66;" f
rlPosDir src/Dodge/RoomLink.hs 112;" f rlPosDir src/Dodge/RoomLink.hs 112;" f
rlauncherPic src/Dodge/Item/Draw/SPic.hs 399;" f rlauncherPic src/Dodge/Item/Draw/SPic.hs 399;" f
rmInLinks src/Dodge/RoomLink.hs 153;" f rmInLinks src/Dodge/RoomLink.hs 153;" f
@@ -4968,7 +4968,7 @@ shootingRange src/Dodge/Room/Room.hs 356;" f
shortPoint2 src/Dodge/ShortShow.hs 4;" f shortPoint2 src/Dodge/ShortShow.hs 4;" f
shortShow src/ShortShow.hs 7;" f shortShow src/ShortShow.hs 7;" f
shotgunS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 527;" f shotgunS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 527;" f
shoulderHeight src/Dodge/Item/HeldOffset.hs 64;" f shoulderHeight src/Dodge/Item/HeldOffset.hs 63;" f
showAttachItem src/Dodge/Item/Display.hs 92;" f showAttachItem src/Dodge/Item/Display.hs 92;" f
showEquipItem src/Dodge/Item/Display.hs 108;" f showEquipItem src/Dodge/Item/Display.hs 108;" f
showInt src/Dodge/Item/Info.hs 75;" f showInt src/Dodge/Item/Info.hs 75;" f
@@ -5136,7 +5136,7 @@ strFromEquipment src/Dodge/Creature/Statistics.hs 53;" f
strFromHeldItem src/Dodge/Creature/Statistics.hs 67;" f strFromHeldItem src/Dodge/Creature/Statistics.hs 67;" f
strengthFactor src/Dodge/Creature/Impulse/Movement.hs 51;" f strengthFactor src/Dodge/Creature/Impulse/Movement.hs 51;" f
strictify src/MaybeHelp.hs 35;" f strictify src/MaybeHelp.hs 35;" f
strideRot src/Dodge/Item/HeldOffset.hs 67;" f strideRot src/Dodge/Item/HeldOffset.hs 66;" f
stringToList src/Picture/Base.hs 308;" f stringToList src/Picture/Base.hs 308;" f
stringToListGrad src/Picture/Text.hs 12;" f stringToListGrad src/Picture/Text.hs 12;" f
stripZ src/Geometry/Vector3D.hs 97;" f stripZ src/Geometry/Vector3D.hs 97;" f
@@ -5293,14 +5293,14 @@ tractorPullPos src/Dodge/TractorBeam/Update.hs 33;" f
tractorSPic src/Dodge/TractorBeam/Draw.hs 10;" f tractorSPic src/Dodge/TractorBeam/Draw.hs 10;" f
tranRot src/Picture/Base.hs 116;" f tranRot src/Picture/Base.hs 116;" f
transMat src/MatrixHelper.hs 87;" f transMat src/MatrixHelper.hs 87;" f
transToHandle src/Dodge/Item/HeldOffset.hs 28;" f transToHandle src/Dodge/Item/HeldOffset.hs 29;" f
translate src/Picture/Base.hs 108;" f translate src/Picture/Base.hs 108;" f
translate3 src/Picture/Base.hs 112;" f translate3 src/Picture/Base.hs 112;" f
translateFloatingCamera src/Dodge/Update/Camera.hs 50;" f translateFloatingCamera src/Dodge/Update/Camera.hs 50;" f
translateFloatingCameraKeys src/Dodge/Update/Camera.hs 68;" f translateFloatingCameraKeys src/Dodge/Update/Camera.hs 68;" f
translateH src/Picture/Base.hs 104;" f translateH src/Picture/Base.hs 104;" f
translatePointToLeftHand src/Dodge/Creature/HandPos.hs 70;" f translatePointToLeftHand src/Dodge/Creature/HandPos.hs 76;" f
translatePointToRightHand src/Dodge/Creature/HandPos.hs 38;" f translatePointToRightHand src/Dodge/Creature/HandPos.hs 37;" f
translateSH src/Shape.hs 242;" f translateSH src/Shape.hs 242;" f
translateSHxy src/Shape.hs 246;" f translateSHxy src/Shape.hs 246;" f
translateSHz src/Shape.hs 250;" f translateSHz src/Shape.hs 250;" f
@@ -5308,11 +5308,11 @@ translateSP src/ShapePicture.hs 53;" f
translateSPxy src/ShapePicture.hs 45;" f translateSPxy src/ShapePicture.hs 45;" f
translateSPz src/ShapePicture.hs 49;" f translateSPz src/ShapePicture.hs 49;" f
translateScreenPos src/Dodge/ScreenPos.hs 12;" f translateScreenPos src/Dodge/ScreenPos.hs 12;" f
translateToES src/Dodge/Creature/HandPos.hs 25;" f translateToES src/Dodge/Creature/HandPos.hs 24;" f
translateToLeftHand src/Dodge/Creature/HandPos.hs 73;" f translateToLeftHand src/Dodge/Creature/HandPos.hs 79;" f
translateToLeftLeg src/Dodge/Creature/HandPos.hs 94;" f translateToLeftLeg src/Dodge/Creature/HandPos.hs 100;" f
translateToRightHand src/Dodge/Creature/HandPos.hs 57;" f translateToRightHand src/Dodge/Creature/HandPos.hs 63;" f
translateToRightLeg src/Dodge/Creature/HandPos.hs 111;" f translateToRightLeg src/Dodge/Creature/HandPos.hs 117;" f
translateXY src/Polyhedra.hs 23;" f translateXY src/Polyhedra.hs 23;" f
trapTBH src/Geometry/Polygon.hs 22;" f trapTBH src/Geometry/Polygon.hs 22;" f
trapezionBWHW src/Geometry/Polygon.hs 34;" f trapezionBWHW src/Geometry/Polygon.hs 34;" f
@@ -5349,7 +5349,7 @@ trySynthBullet src/Dodge/Creature/State.hs 167;" f
tryThrust src/Dodge/Projectile/Update.hs 126;" f tryThrust src/Dodge/Projectile/Update.hs 126;" f
tryUseParent src/Dodge/Creature/State.hs 145;" f tryUseParent src/Dodge/Creature/State.hs 145;" f
turnTo src/Dodge/Movement/Turn.hs 8;" f turnTo src/Dodge/Movement/Turn.hs 8;" f
turretItemOffset src/Dodge/Item/HeldOffset.hs 22;" f turretItemOffset src/Dodge/Item/HeldOffset.hs 23;" f
tutAnoTree src/Dodge/Room/Tutorial.hs 53;" f tutAnoTree src/Dodge/Room/Tutorial.hs 53;" f
tutDrop src/Dodge/Room/Tutorial.hs 99;" f tutDrop src/Dodge/Room/Tutorial.hs 99;" f
tutHub src/Dodge/Room/Tutorial.hs 412;" f tutHub src/Dodge/Room/Tutorial.hs 412;" f
@@ -5362,7 +5362,7 @@ twinSlowDoorChasers src/Dodge/Room/LongDoor.hs 80;" f
twinSlowDoorRoom src/Dodge/Room/LongDoor.hs 36;" f twinSlowDoorRoom src/Dodge/Room/LongDoor.hs 36;" f
twists src/Dodge/Creature/Test.hs 103;" f twists src/Dodge/Creature/Test.hs 103;" f
twoFlat src/Dodge/Creature/Test.hs 100;" f twoFlat src/Dodge/Creature/Test.hs 100;" f
twoFlatHRot src/Dodge/Item/HeldOffset.hs 76;" f twoFlatHRot src/Dodge/Item/HeldOffset.hs 75;" f
twoHandTwistAmount src/Dodge/Creature/YourControl.hs 166;" f twoHandTwistAmount src/Dodge/Creature/YourControl.hs 166;" f
twoRoomPoss src/Dodge/PlacementSpot.hs 148;" f twoRoomPoss src/Dodge/PlacementSpot.hs 148;" f
twoStep1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 519;" f twoStep1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 519;" f
+20 -10
View File
@@ -2,23 +2,27 @@
import Test.Tasty import Test.Tasty
import qualified Test.Tasty.QuickCheck as QC import qualified Test.Tasty.QuickCheck as QC
import Test.Tasty.HUnit import Test.Tasty.HUnit
import Dodge.Room.CheckConsistency --import Dodge.Room.CheckConsistency
--import Geometry --import Geometry
import Dodge.LevelGen.StaticWalls --import Dodge.LevelGen.StaticWalls
import Geometry import Geometry
import Data.Maybe import Data.Maybe
main :: IO () main :: IO ()
main = defaultMain $ main = defaultMain $
testGroup "Tests" testGroup "Tests"
[testGroup "Geometry tests" geometryTests] [testGroup "Geometry tests" geometryTests
,testGroup "angleVV" angleVVTests
]
geometryTests :: [TestTree]
geometryTests = geometryTests =
[ testGroup "(HUnit)" geometryUnitTests [ testGroup "(HUnit)" geometryUnitTests
, testGroup "(QuickCheck)" geometryQuickCheckTests , testGroup "(QuickCheck)" geometryQuickCheckTests
] ]
geometryUnitTests :: [TestTree]
geometryUnitTests = geometryUnitTests =
[ testCase "intersectSegSegTest cross intersect" $ [ testCase "intersectSegSegTest cross intersect" $
intersectSegSegTest (V2 1 0) (V2 1 2) (V2 0 1) (V2 2 1) intersectSegSegTest (V2 1 0) (V2 1 2) (V2 0 1) (V2 2 1)
@@ -30,28 +34,29 @@ geometryUnitTests =
intersectSegSegTest (V2 1 0) (V2 1 2) (V2 0 0) (V2 0 2) intersectSegSegTest (V2 1 0) (V2 1 2) (V2 0 0) (V2 0 2)
@?= False @?= False
, testCase "circOnSeg endpoint1" $ , testCase "circOnSeg endpoint1" $
circOnSeg (V2 0 0) (V2 10 10) (V2 (-1) (-1)) 2 circOnSeg (V2 (-1) (-1)) 2 (V2 0 0) (V2 10 10)
@?= True @?= True
, testCase "circOnSeg endpoint2" $ , testCase "circOnSeg endpoint2" $
circOnSeg (V2 0 0) (V2 10 10) (V2 11 10) 2 circOnSeg (V2 11 10) 2 (V2 0 0) (V2 10 10)
@?= True @?= True
, testCase "circOnSeg mid" $ , testCase "circOnSeg mid" $
circOnSeg (V2 0 0) (V2 10 10) (V2 5 5) 2 circOnSeg (V2 5 5) 2 (V2 0 0) (V2 10 10)
@?= True @?= True
, testCase "circOnSeg mid" $ , testCase "circOnSeg mid" $
circOnSeg (V2 0 0) (V2 10 10) (V2 5 4) 2 circOnSeg (V2 5 4) 2 (V2 0 0) (V2 10 10)
@?= True @?= True
, testCase "circOnSeg miss endpoint1" $ , testCase "circOnSeg miss endpoint1" $
circOnSeg (V2 0 0) (V2 10 10) (V2 (-1) (-1)) 1 circOnSeg (V2 (-1) (-1)) 1 (V2 0 0) (V2 10 10)
@?= False @?= False
, testCase "circOnSeg miss endpoint2" $ , testCase "circOnSeg miss endpoint2" $
circOnSeg (V2 0 0) (V2 10 10) (V2 11 10) 0.9 circOnSeg (V2 11 10) 0.9 (V2 0 0) (V2 10 10)
@?= False @?= False
, testCase "circOnSeg miss mid" $ , testCase "circOnSeg miss mid" $
circOnSeg (V2 0 0) (V2 10 10) (V2 7 3) 0.9 circOnSeg (V2 7 3) 0.9 (V2 0 0) (V2 10 10)
@?= False @?= False
] ]
geometryQuickCheckTests :: [TestTree]
geometryQuickCheckTests = geometryQuickCheckTests =
[ QC.testProperty "intersectSegSeg--intersectSegSegTest" $ [ QC.testProperty "intersectSegSeg--intersectSegSegTest" $
\(x1,y1,x2,y2,x3,y3,x4,y4) -> \(x1,y1,x2,y2,x3,y3,x4,y4) ->
@@ -59,6 +64,11 @@ geometryQuickCheckTests =
== intersectSegSegTest (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)
] ]
angleVVTests :: [TestTree]
angleVVTests = [QC.testProperty "random vectors give positive result" $
\(x,y,a,b) -> 0 <= angleVV (V2 x y) (V2 a b)
]
--nextPair :: Eq a => (a,a) -> [(a,a)] -> [(a,a)] --nextPair :: Eq a => (a,a) -> [(a,a)] -> [(a,a)]
--nextPair (_,y) = filter (\(x,_) -> x == y) --nextPair (_,y) = filter (\(x,_) -> x == y)
-- --