<commit_before>{-# LANGUAGE OverloadedStrings #-}

module Text.CorasickPark.AlgorithmSpec (spec) where

import Test.Hspec

import Text.CorasickPark.Types
import Text.CorasickPark.Algorithm

spec :: Spec
spec = do
  describe "downcase" $ do
    it "changes the target to lower-case" $ do
      let op = Operation { target = Target { text          = "FOO"
                                           , caseSensitive = True
                                           , leftBoundary  = InputBoundary
                                           , rightBoundary = InputBoundary
                                           , global        = False }
                         , transform = Downcase }

      applyOperation op "FOO" `shouldBe` "foo"

  describe "upcase" $ do
    it "changes the target to upper-case" $ do
      let op = Operation { target = Target { text          = "foo"
                                           , caseSensitive = True
                                           , leftBoundary  = InputBoundary
                                           , rightBoundary = InputBoundary
                                           , global        = False }
                         , transform = Upcase }<commit_msg>Apply hlint suggestions<commit_after>{-# LANGUAGE OverloadedStrings #-}

module Text.CorasickPark.AlgorithmSpec (spec) where

import Test.Hspec

import Text.CorasickPark.Types
import Text.CorasickPark.Algorithm

spec :: Spec
spec = do
  describe "downcase" $
    it "changes the target to lower-case" $ do
      let op = Operation { target = Target { text          = "FOO"
                                           , caseSensitive = True
                                           , leftBoundary  = InputBoundary
                                           , rightBoundary = InputBoundary
                                           , global        = False }
                         , transform = Downcase }

      applyOperation op "FOO" `shouldBe` "foo"

  describe "upcase" $
    it "changes the target to upper-case" $ do
      let op = Operation { target = Target { text          = "foo"
                                           , caseSensitive = True
                                           , leftBoundary  = InputBoundary
                                           , rightBoundary = InputBoundary
                                           , global        = False }
                         , transform = Upcase }
{'fraction_non_alphanumeric': 0.06459525756336877, 'fraction_numerical': 0.0, 'mean_word_length': 1.0684699915469147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2751638', 'n_tokens_mistral': 520, 'n_tokens_neox': 505, 'n_words': 152}