summaryrefslogtreecommitdiff
path: root/test.hs
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2024-03-19 16:03:38 +1100
committerJustin Bedo <cu@cua0.org>2024-03-20 16:01:18 +1100
commitd814e4da1720f01725caa1e82a1ffff7a675720d (patch)
tree691f82d18b205cef8ec8212c1a9cb66d6de88d59 /test.hs
parenta837c5e2f2d41852313943a326e38c36487c64c3 (diff)
fix sloppy fastq parsing
Previously chunked on @, which prevented it being used in quality scores
Diffstat (limited to 'test.hs')
-rw-r--r--test.hs21
1 files changed, 13 insertions, 8 deletions
diff --git a/test.hs b/test.hs
index a8780ff..b0574a1 100644
--- a/test.hs
+++ b/test.hs
@@ -10,6 +10,7 @@ import Data.Function
import qualified Streamly.Data.Fold as F
import qualified Streamly.Data.Stream as S
import qualified Streamly.Data.Unfold as U
+import System.IO.Temp
import Test.QuickCheck
import Test.QuickCheck.Arbitrary
import Test.QuickCheck.Monadic
@@ -19,15 +20,19 @@ instance Arbitrary Read where
arbitrary = Read <$> genStr <*> genStr <*> genStr
where
genBS = fmap B.pack . listOf . elements
- genStr = genBS $ [' ' .. '*'] ++ [',' .. '?'] ++ ['A' .. '~']
+ genStr = genBS $ [' ' .. '~']
main :: IO ()
main = quickCheckWith stdArgs {maxSuccess = 10000} $ \rp -> monadicIO $ do
- rp' <- run $ do
- S.unfold U.fromList rp & unparse "a" "b"
- cnt <- B.readFile "a"
- B.writeFile "a" $ cnt <> cnt
- cnt <- B.readFile "b"
- B.writeFile "b" $ cnt <> cnt
- parse "a" "b" & S.fold F.toList
+ rp' <- run $ withSystemTempDirectory "dedumi-test" $ \root -> do
+ let a = root <> "/a"
+ b = root <> "/b"
+ a' = root <> "/a2"
+ b' = root <> "/b2"
+ S.unfold U.fromList rp & unparse a b
+ cnt <- B.readFile a
+ B.writeFile a' $ cnt <> cnt
+ cnt <- B.readFile b
+ B.writeFile b' $ cnt <> cnt
+ parse a' b' & S.fold F.toList
assert $ rp <> rp == rp'