From 5b170b5f956f91f46e0292484c5b9f773876cb29 Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Mon, 11 Aug 2008 21:46:10 -0500 Subject: [PATCH] Added prop_readBytes --- testsrc/TestConnection.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testsrc/TestConnection.hs b/testsrc/TestConnection.hs index 0bc6ac3..a844411 100644 --- a/testsrc/TestConnection.hs +++ b/testsrc/TestConnection.hs @@ -51,11 +51,18 @@ prop_readLine s = runLinesConnection s readLine @?= (head s, (expectedString (tail s), [])) +prop_readBytes :: String -> Int -> Property +prop_readBytes s l = + l <= length s && l >= 0 ==> + runStringConnection s (\c -> readBytes c (fromIntegral l)) == + (take l s, (drop l s, [])) + q :: Testable a => String -> a -> HU.Test q = qccheck (defaultConfig {configMaxTest = 250, configMaxFail = 5000}) allt = [q "Identity" prop_identity, q "Lines identity" prop_linesidentity, q "Lines list identity" prop_lineslistidentity, - q "readline" prop_readLine + q "readline" prop_readLine, + q "readBytes" prop_readBytes ] -- 2.39.2