0

我是 Elm 的新手,我对 elm-test 有一些疑问。我尝试在同一个测试中有多个期望,但没有找到方法。所以这是我现在所做的,但它并没有真正的表现力

suite : Test
suite =
    describe "2048-elm"
        [ test "moveLeftWithZero" <|
            \_ ->
                let
                    expectedCases =
                        [ ( [ 2, 0, 0, 2 ], [ 4, 0, 0, 0 ] )
                        , ( [ 2, 2, 0, 4 ], [ 4, 4, 0, 0 ] )
                        , ( [ 0, 0, 0, 4 ], [ 4, 0, 0, 0 ] )
                        , ( [ 0, 0, 2, 4 ], [ 2, 4, 0, 0 ] )
                        , ( [ 2, 4, 2, 4 ], [ 2, 4, 2, 4 ] )
                        , ( [ 2, 2, 2, 2 ], [ 4, 4, 0, 0 ] )
                        ]

                    toTest =
                        List.map (\expected -> ( Tuple.first expected, Main.moveLeftWithZero (Tuple.first expected) )) expectedCases
                in
                Expect.equal expectedCases toTest
        ]

我试过了,Expect.all但它似乎没有做我想要的

4

0 回答 0