<commit_before>{-# LANGUAGE OverloadedStrings #-}

{-
  % runghc -i.. Test.hs
-}

module Main where

import Config.Internal
import Route
import Test.Framework (defaultMain, testGroup, Test)
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test)
import Types
tests :: [Test]
tests = [
    testGroup "Parser" [
         testCase "config" test_config
       , testCase "route" test_route
       ]
  ]

----------------------------------------------------------------

test_config :: Assertion
test_config = do
    res <- parseConfig "sample.conf"
    res @?= ans
 where
    ans = [("Port",CV_Int 8080),("Debug_Mode",CV_Bool True),("User",CV_String "nobody"),("Group",CV_String "nobody"),("Pid_File",CV_String "/var/run/mighty.pid"),("Index_File",CV_String "index.html")]

test_route :: Assertion
test_route = do
    res <- parseRoute "sample.route"
    res @?= ans
 where
    ans = [Block ["localhost"] [Mapper "/~kazu/cgi-bin/" OpCGI "/Users/kazu/Sites/cgi-bin/",Mapper "/~kazu/" OpFile "/Users/kazu/Sites/",Mapper "/runhaskell/cgi-bin/" OpCGI "/Users/kazu/work/runhaskell/cgi-bin/",Mapper "/runhaskell/" OpFile "/Users/kazu/work/runhaskell/",Mapper "/monad/" OpFile "/Users/kazu/work/monad/html/",Mapper "/" OpFile "/Users/kazu/Mew.org/"]]
<commit_msg>mod name is Test.<commit_after>{-# LANGUAGE OverloadedStrings #-}

{-
  % runghc -i.. Test.hs
-}

module Test where

import Config.Internal
import Route
import Test.Framework (defaultMain, testGroup, Test)
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test)
import Types
tests :: [Test]
tests = [
    testGroup "Parser" [
         testCase "config" test_config
       , testCase "route" test_route
       ]
  ]

----------------------------------------------------------------

test_config :: Assertion
test_config = do
    res <- parseConfig "sample.conf"
    res @?= ans
 where
    ans = [("Port",CV_Int 8080),("Debug_Mode",CV_Bool True),("User",CV_String "nobody"),("Group",CV_String "nobody"),("Pid_File",CV_String "/var/run/mighty.pid"),("Index_File",CV_String "index.html")]

test_route :: Assertion
test_route = do
    res <- parseRoute "sample.route"
    res @?= ans
 where
    ans = [Block ["localhost"] [Mapper "/~kazu/cgi-bin/" OpCGI "/Users/kazu/Sites/cgi-bin/",Mapper "/~kazu/" OpFile "/Users/kazu/Sites/",Mapper "/runhaskell/cgi-bin/" OpCGI "/Users/kazu/work/runhaskell/cgi-bin/",Mapper "/runhaskell/" OpFile "/Users/kazu/work/runhaskell/",Mapper "/monad/" OpFile "/Users/kazu/work/monad/html/",Mapper "/" OpFile "/Users/kazu/Mew.org/"]]

{'fraction_non_alphanumeric': 0.2141167192429022, 'fraction_numerical': 0.0031545741324921135, 'mean_word_length': 3.098546042003231, 'pattern_counts': {'":': 0, '<': 7, '<?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': '859151', 'n_tokens_mistral': 888, 'n_tokens_neox': 855, 'n_words': 175}