test_parses_function_blocks :: Assertion
test_parses_function_blocks =
  let program = "box(a, a, 2)\n\tb = 2 * 0.5\n\tbox(a, b, 1)\n"
      ass     = ElAssign $ AbsoluteAssignment "b" $ BinaryOp "*"
                                                             (EVal $ Number 2)
                                                             (EVal $ Number 0.5)
      box2 = ElExpression $ EApp $ Application
        (LocalVariable "box")
        [ ApplicationSingleArg $ EVar $ LocalVariable "a"
        , ApplicationSingleArg $ EVar $ LocalVariable "b"
        , ApplicationSingleArg $ EVal $ Number 1
        ]
        Nothing
      box1 =
          StExpression
            $ EApp
            $ Application
                (LocalVariable "box")
                [ ApplicationSingleArg $ EVar $ LocalVariable "a"
                , ApplicationSingleArg $ EVar $ LocalVariable "a"
                , ApplicationSingleArg $ EVal $ Number 2
                ]
            $ Just (Lambda [] Nothing $ Block [ass, box2])
      expected = Program [box1]
  in  parserTest program expected
test_parses_function_blocks :: Assertion
test_parses_function_blocks =
  let program = "box(a, a, 2)\n\tb = 2 * 0.5\n\tbox(a, b, 1)\n"
      ass     = ElAssign $ AbsoluteAssignment "b" $ BinaryOp "*"
                                                             (EVal $ Number 2)
                                                             (EVal $ Number 0.5)
      box2 = ElExpression $ EApp $ Application
        (LocalVariable "box")
        [ ApplicationSingleArg $ EVar $ LocalVariable "a"
        , ApplicationSingleArg $ EVar $ LocalVariable "b"
        , ApplicationSingleArg $ EVal $ Number 1
        ]
        Nothing
      box1 =
          StExpression
            $ EApp
            $ Application
                (LocalVariable "box")
                [ ApplicationSingleArg $ EVar $ LocalVariable "a"
                , ApplicationSingleArg $ EVar $ LocalVariable "a"
                , ApplicationSingleArg $ EVal $ Number 2
                ]
            $ Just (Lambda [] Nothing $ Block [ass, box2])
      expected = Program [box1]
  in  parserTest program expected
test_parses_function_blocks =
  let program = "box(a, a, 2)\n\tb = 2 * 0.5\n\tbox(a, b, 1)\n"
      ass     = ElAssign $ AbsoluteAssignment "b" $ BinaryOp "*"
                                                             (EVal $ Number 2)
                                                             (EVal $ Number 0.5)
      box2 = ElExpression $ EApp $ Application
        (LocalVariable "box")
        [ ApplicationSingleArg $ EVar $ LocalVariable "a"
        , ApplicationSingleArg $ EVar $ LocalVariable "b"
        , ApplicationSingleArg $ EVal $ Number 1
        ]
        Nothing
      box1 =
          StExpression
            $ EApp
            $ Application
                (LocalVariable "box")
                [ ApplicationSingleArg $ EVar $ LocalVariable "a"
                , ApplicationSingleArg $ EVar $ LocalVariable "a"
                , ApplicationSingleArg $ EVal $ Number 2
                ]
            $ Just (Lambda [] Nothing $ Block [ass, box2])
      expected = Program [box1]
  in  parserTest program expected