-- | Rudimentary tests.  Read the source as a form of documentation.
tests :: Bool
tests = and $
    (("file_1.txt" =~+ "^(.*)_(\\d).txt$") ==
     [ ( "file_1.txt" , ( 0 , 10 ) )
     , ( "file" , ( 0 , 4 ) )
     , ( "1" , ( 5 , 1 ) )
     ]) :

    (("file_1.txt" =~- "^(.*)_(\\d).txt$") ==
     ["file_1.txt", "file", "1"]) :

    ("file_1.txt" =~# "^(.*)_(\\d).txt$") :

    (let q :: LBS = "wif kwof ..wif,, wif,  8fwif"
         p :: SBS = "\\Sw.f"
     in ((q =~+ p) ==
         [ ( "kwof" , (  4 , 4 ) ) ]) &&
        ((q =~++ p) ==
         [ [ ( "kwof" , (  4 , 4 ) ) ]
         , [ ( ".wif" , ( 10 , 4 ) ) ]
         , [ ( "fwif" , ( 24 , 4 ) ) ]
         ])) :

    (let q :: LBS = "wif kwof ..wif,, wif,  8fwif"
         p :: SBS = "\\Sw.f"
         f ([(a,_)] :: [(LBS, (MatchOffset, MatchLength))]) = Just $ "@" <> a <> "@"
     in (replaceRegex q p f == "wif @kwof@ ..wif,, wif,  8fwif") &&
        (replaceRegexAll q p f == "wif @kwof@ .@.wif@,, wif,  8@fwif@")) :

    []
tests :: Bool
tests = and $
    (("file_1.txt" =~+ "^(.*)_(\\d).txt$") ==
     [ ( "file_1.txt" , ( 0 , 10 ) )
     , ( "file" , ( 0 , 4 ) )
     , ( "1" , ( 5 , 1 ) )
     ]) :

    (("file_1.txt" =~- "^(.*)_(\\d).txt$") ==
     ["file_1.txt", "file", "1"]) :

    ("file_1.txt" =~# "^(.*)_(\\d).txt$") :

    (let q :: LBS = "wif kwof ..wif,, wif,  8fwif"
         p :: SBS = "\\Sw.f"
     in ((q =~+ p) ==
         [ ( "kwof" , (  4 , 4 ) ) ]) &&
        ((q =~++ p) ==
         [ [ ( "kwof" , (  4 , 4 ) ) ]
         , [ ( ".wif" , ( 10 , 4 ) ) ]
         , [ ( "fwif" , ( 24 , 4 ) ) ]
         ])) :

    (let q :: LBS = "wif kwof ..wif,, wif,  8fwif"
         p :: SBS = "\\Sw.f"
         f ([(a,_)] :: [(LBS, (MatchOffset, MatchLength))]) = Just $ "@" <> a <> "@"
     in (replaceRegex q p f == "wif @kwof@ ..wif,, wif,  8fwif") &&
        (replaceRegexAll q p f == "wif @kwof@ .@.wif@,, wif,  8@fwif@")) :

    []
tests = and $
    (("file_1.txt" =~+ "^(.*)_(\\d).txt$") ==
     [ ( "file_1.txt" , ( 0 , 10 ) )
     , ( "file" , ( 0 , 4 ) )
     , ( "1" , ( 5 , 1 ) )
     ]) :

    (("file_1.txt" =~- "^(.*)_(\\d).txt$") ==
     ["file_1.txt", "file", "1"]) :

    ("file_1.txt" =~# "^(.*)_(\\d).txt$") :

    (let q :: LBS = "wif kwof ..wif,, wif,  8fwif"
         p :: SBS = "\\Sw.f"
     in ((q =~+ p) ==
         [ ( "kwof" , (  4 , 4 ) ) ]) &&
        ((q =~++ p) ==
         [ [ ( "kwof" , (  4 , 4 ) ) ]
         , [ ( ".wif" , ( 10 , 4 ) ) ]
         , [ ( "fwif" , ( 24 , 4 ) ) ]
         ])) :

    (let q :: LBS = "wif kwof ..wif,, wif,  8fwif"
         p :: SBS = "\\Sw.f"
         f ([(a,_)] :: [(LBS, (MatchOffset, MatchLength))]) = Just $ "@" <> a <> "@"
     in (replaceRegex q p f == "wif @kwof@ ..wif,, wif,  8fwif") &&
        (replaceRegexAll q p f == "wif @kwof@ .@.wif@,, wif,  8@fwif@")) :

    []