<commit_before>import Expect
import Test exposing (..)
import Test.Runner.Html
import Canvas exposing (Canvas, Size)
import Array exposing (Array)

main : Test.Runner.Html.TestProgram
main =
    [ testToDataURL
    ]
      |> concat
      |> Test.Runner.Html.run


testToDataURL : Test
testToDataURL =
    describe "getImageData"
        [ test "A 1x1 empty canvas initializes properly" <|
            \() ->
                let
                    expectation : Array Int
                    expectation =
                        Array.repeat 4 0

                    canvas : Canvas
                    canvas =
                        Canvas.initialize (Size 1 1)
                in
                    Expect.equal (Canvas.getImageData canvas) expectation

        , test "A 5x5 empty canvas initializes properly" <|
            \() ->
                let
                    expectation : Array Int
                    expectation =
                        Array.repeat 100 0

                    canvas : Canvas
                    canvas =
                        Canvas.initialize (Size 5 5)
                in
                    Expect.equal (Canvas.getImageData canvas) expectation
        ]

<commit_msg>Initial idea for unit tests.<commit_after>import Expect
import Test exposing (..)
import Test.Runner.Html
import Canvas exposing (Canvas, Size)
import Canvas.Point exposing (Point)
import Array exposing (Array)

main : Test.Runner.Html.TestProgram
main =
    [ testInitializeGetImageData
    ]
      |> concat
      |> Test.Runner.Html.run


testInitializeGetImageData : Test
testInitializeGetImageData =
    describe "getImageData"
        [ test "A 1x1 empty canvas initializes properly" <|
            \() ->
                let
                    expectation : Array Int
                    expectation =
                        Array.repeat 4 0

                    canvas : Canvas
                    canvas =
                        Canvas.initialize (Size 1 1)

                    imageData : Array Int
                    imageData =
                        let
                            origin : Point
                            origin = Canvas.Point.fromInts ( 0, 0 )

                            size : Size
                            size = Canvas.getSize canvas
                        in
                            canvas
                                |> Canvas.getImageData origin size
                in
                    Expect.equal imageData expectation

        , test "A 5x5 empty canvas initializes properly" <|
            \() ->
                let
                    expectation : Array Int
                    expectation =
                        Array.repeat 100 0

                    canvas : Canvas
                    canvas =
                        Canvas.initialize (Size 5 5)

                    imageData : Array Int
                    imageData =
                        let
                            origin : Point
                            origin = Canvas.Point.fromInts ( 0, 0 )

                            size : Size
                            size = Canvas.getSize canvas
                        in
                            canvas
                                |> Canvas.getImageData origin size
                in
                    Expect.equal imageData expectation
        ]


{'fraction_non_alphanumeric': 0.05405405405405406, 'fraction_numerical': 0.009504009504009503, 'mean_word_length': 0.9412103746397694, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3056969', 'n_tokens_mistral': 791, 'n_tokens_neox': 697, 'n_words': 210}