<commit_before>module TiltakTests exposing (..)

import Expect exposing (Expectation)
import Test exposing (Test, describe, test)
import TestSupport exposing (..)
import Tiltak


suite : Test
suite =
    Test.concat
        ([ describe "checkMaybe"
            [ test "it always fails for Nothing" <|
                \_ ->
                    let
                        expectation =
                            Nothing |> checkMaybe (Expect.equal 80)
                    in
                        expectation |> Expect.equal (Expect.fail "Got nothing")
            , test "it can check equality for Just" <|
                \_ ->
                    Just 80 |> checkMaybe (Expect.equal 80)
            ]
         , describe "samples"
            [ test "linear function" <|
                \() ->
                    let
                        func x =
                            x * 2 - 1.0e6
                    in
                        Tiltak.samples 5.0e4 func
                            |> Expect.equal
                                [ 3.0e5
                                , 3.5e5
                                , 4.0e5
                                , 4.5e5
                                , 5.0e5
                                , 5.5e5
                                , 6.0e5
                                , 6.5e5
                                , 7.0e5
                                ]
            , test "when nullpunkt hits a a sample" <|
                \() ->
                    Tiltak.samplesFromBreakEvenPoint 5.0e4 5.0e5
                        |> Expect.equal
                            [ 3.0e5
                            , 3.5e5
                            , 4.0e5
                            , 4.5e5
                            , 5.0e5
                            , 5.5e5
                            , 6.0e5
                            , 6.5e5
                            , 7.0e5
                            ]
            , test "calculate exact breakEvenPoint and rounded to stepsize" <|
                \() ->
                    Tiltak.samplesFromBreakEvenPoint 10 101
                        |> Expect.equal
                            [ 60
                            , 70
                            , 80
                            , 90
                            , 100
                            , 101
                            , 110
                            , 120
                            , 130
                            , 140
                            ]
            , test "flat function gives empty list" <|
                \() ->
                    let
                        func _ =
                            5
                    in
                        Tiltak.samples 36 func |> Expect.equal []
            ]
         ]
        )<commit_msg>Regroup tests.<commit_after>module TiltakTests exposing (..)

import Expect exposing (Expectation)
import Test exposing (Test, describe, test)
import TestSupport exposing (..)
import Tiltak


suite : Test
suite =
    Test.concat
        ([ describe "checkMaybe"
            [ test "it always fails for Nothing" <|
                \_ ->
                    let
                        expectation =
                            Nothing |> checkMaybe (Expect.equal 80)
                    in
                        expectation |> Expect.equal (Expect.fail "Got nothing")
            , test "it can check equality for Just" <|
                \_ ->
                    Just 80 |> checkMaybe (Expect.equal 80)
            ]
         , describe "samples"
            [ test "linear function" <|
                \() ->
                    let
                        func x =
                            x * 2 - 1.0e6
                    in
                        Tiltak.samples 5.0e4 func
                            |> Expect.equal
                                [ 3.0e5
                                , 3.5e5
                                , 4.0e5
                                , 4.5e5
                                , 5.0e5
                                , 5.5e5
                                , 6.0e5
                                , 6.5e5
                                , 7.0e5
                                ]
            , test "flat function gives empty list" <|
                \() ->
                    let
                        func _ =
                            5
                    in
                        Tiltak.samples 36 func |> Expect.equal []
            ]
         , describe "samplesFromBreakEvenPoint"
            [ test "when nullpunkt hits a a sample" <|
                \() ->
                    Tiltak.samplesFromBreakEvenPoint 5.0e4 5.0e5
                        |> Expect.equal
                            [ 3.0e5
                            , 3.5e5
                            , 4.0e5
                            , 4.5e5
                            , 5.0e5
                            , 5.5e5
                            , 6.0e5
                            , 6.5e5
                            , 7.0e5
                            ]
            , test "calculate exact breakEvenPoint and rounded to stepsize" <|
                \() ->
                    Tiltak.samplesFromBreakEvenPoint 10 101
                        |> Expect.equal
                            [ 60
                            , 70
                            , 80
                            , 90
                            , 100
                            , 101
                            , 110
                            , 120
                            , 130
                            , 140
                            ]
            ]
         ]
        )
{'fraction_non_alphanumeric': 0.0644651326190058, 'fraction_numerical': 0.0375900228350606, 'mean_word_length': 0.4952731092436975, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '772754', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1219, 'n_words': 273}