<commit_before>{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
module Main (main) where

import Control.Concurrent
import Control.Monad
import Control.Monad.Trans
import Data.ByteString.Char8 (ByteString, pack)
import System.Time
import qualified Test.HUnit as Test
import Test.HUnit (runTestTT, (~:))

import Database.Redis


type BS = ByteString

------------------------------------------------------------------------------
-- Main and helpers
--
main :: IO ()
main = do
    c <- connect "127.0.0.1" (PortNumber 6379)
    runTestTT $ Test.TestList $ map ($c) tests
    disconnect c

type Test = RedisConn -> Test.Test

testCase :: String -> Redis () -> Test
testCase name r conn = name ~:
    Test.TestCase $ runRedis conn $ flushall >>=? Ok >> r
    
(>>=?) :: (Eq a, Show a) => Redis (Either Reply a) -> a -> Redis ()<commit_msg>Use defaultPort in tests. Use flushdb instead of flushall, does not seem to write to disk.<commit_after>{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
module Main (main) where

import Control.Concurrent
import Control.Monad
import Control.Monad.Trans
import Data.ByteString.Char8 (ByteString, pack)
import System.Time
import qualified Test.HUnit as Test
import Test.HUnit (runTestTT, (~:))

import Database.Redis


type BS = ByteString

------------------------------------------------------------------------------
-- Main and helpers
--
main :: IO ()
main = do
    c <- connect "127.0.0.1" defaultPort
    runTestTT $ Test.TestList $ map ($c) tests
    disconnect c

type Test = RedisConn -> Test.Test

testCase :: String -> Redis () -> Test
testCase name r conn = name ~:
    Test.TestCase $ runRedis conn $ flushdb >>=? Ok >> r
    
(>>=?) :: (Eq a, Show a) => Redis (Either Reply a) -> a -> Redis ()
{'fraction_non_alphanumeric': 0.20558086560364464, 'fraction_numerical': 0.010250569476082005, 'mean_word_length': 2.479207920792079, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '563548', 'n_tokens_mistral': 540, 'n_tokens_neox': 522, 'n_words': 176}