<commit_before>-- | Unit test for PassphraseGenerator functions.

import Test.Hspec
import qualified Data.Map.Strict as Map

import PassphraseGenerator

filetext :: String
filetext = "aaa\t1900\t2\naaa\t1950\t3\nbbb\t1950\t5\nbbb_VERB\t1980\t9"

y :: Int
y = 1950

main :: IO()
main = hspec $ do
  describe "countDescending" $ do
    it "returns LT when the first tuple should come before the second tuple" $
      (countDescending ("aaa", 9) ("bbb", 6)) `shouldBe` LT
    it "returns GT when first tuple comes after second tuple" $
      (countDescending ("aaa", 3) ("bbb", 6)) `shouldBe` GT
    it "returns EQ when no order can be determined between tuples" $
      (countDescending ("aaa", 6) ("bbb", 6)) `shouldBe` EQ

  describe "wordCounts" $ do
    it "aaa should occur 3 times" $ do
      (Map.lookup "aaa" (wordCounts y (lines filetext) Map.empty)) `shouldBe` (Just 3)
    it "bbb should occur 14 times" $ do
      (Map.lookup "bbb" (wordCounts y (lines filetext) Map.empty)) `shouldBe` (Just 14)<commit_msg>Test recently-added case-folding behavior of mostFrequent.hs<commit_after>-- | Unit test for PassphraseGenerator functions.

import Test.Hspec
import qualified Data.Map.Strict as Map

import PassphraseGenerator

filetext :: String
filetext = "aaa\t1900\t2\naaa\t1950\t3\nAAA\t1951\t7\nbbb\t1950\t5\nbbb_VERB\t1980\t9"

y :: Int
y = 1950

main :: IO()
main = hspec $ do
  describe "countDescending" $ do
    it "returns LT when the first tuple should come before the second tuple" $
      (countDescending ("aaa", 9) ("bbb", 6)) `shouldBe` LT
    it "returns GT when first tuple comes after second tuple" $
      (countDescending ("aaa", 3) ("bbb", 6)) `shouldBe` GT
    it "returns EQ when no order can be determined between tuples" $
      (countDescending ("aaa", 6) ("bbb", 6)) `shouldBe` EQ

  describe "wordCounts" $ do
    it "aaa should occur 10 times" $ do
      (Map.lookup "aaa" (wordCounts y (lines filetext) Map.empty)) `shouldBe` (Just 10)
    it "bbb should occur 14 times" $ do
      (Map.lookup "bbb" (wordCounts y (lines filetext) Map.empty)) `shouldBe` (Just 14)
{'fraction_non_alphanumeric': 0.12303290414878398, 'fraction_numerical': 0.037672865999046255, 'mean_word_length': 3.6830357142857144, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4676993', 'n_tokens_mistral': 787, 'n_tokens_neox': 700, 'n_words': 250}