28 lines
848 B
Haskell
28 lines
848 B
Haskell
import Control.Lens
|
|
import OneCommand.Command
|
|
import OneCommand.Generator (generateCommandChainGroup, pos)
|
|
import OneCommand.PosUtil (Vec3i (Vec3i), vec)
|
|
import Test.Hspec
|
|
|
|
main :: IO ()
|
|
main = hspec $ do
|
|
describe "command generation" $ do
|
|
it "generate command normally" $ do
|
|
let myChains =
|
|
[ CommandChain
|
|
{ commands = ["1", "2"],
|
|
chainType = RepeatingChain
|
|
},
|
|
CommandChain
|
|
{ commands = ["3", "4"],
|
|
chainType = ImpulseChain
|
|
}
|
|
]
|
|
|
|
let cmds = generateCommandChainGroup myChains
|
|
|
|
(head cmds ^. pos . vec) `shouldBe` Vec3i 0 0 0
|
|
(cmds !! 1 ^. pos . vec) `shouldBe` Vec3i 0 0 1
|
|
(cmds !! 2 ^. pos . vec) `shouldBe` Vec3i 0 2 0
|
|
(cmds !! 3 ^. pos . vec) `shouldBe` Vec3i 0 2 1
|