Commit Graph

63 Commits

Author SHA1 Message Date
Lennart Kolmodin
fe6389e97a Add tests regarding failure and that BitGet has the current chunk. 2012-04-25 21:42:03 +04:00
Lennart Kolmodin
0e5029eff1 Keep the current chunk within the BitGet monad.
Using the ensureN, get and put methods from binary-0.6.0.0 we
can keep the current chunk within the BitGet monad and put what
remains of the chunk when the monad has finished executing or
if we encounter an error.
2012-04-25 21:39:30 +04:00
Lennart Kolmodin
9443d4e9c8 Guard getByteString for negative numbers.
Return the empty string if n<=0.
2012-03-01 22:55:46 +04:00
Lennart Kolmodin
3bb50f11ec Comment out Random instances.
We should do this conditionally, only not needed if random>=1.0.1.0.
2012-03-01 22:54:54 +04:00
Lennart Kolmodin
0ed38e7ca5 Test for trying to read negative length with getByteString.
If not checking the requested read length, we're most likely to
segfault.
2012-03-01 22:48:07 +04:00
Lennart Kolmodin
3ab9b9ab10 Update the .cabal file that we moved the sources to github. 2012-01-26 15:25:39 +04:00
Lennart Kolmodin
df45a36c23 Add test for Applicative BitGet.
What's more interesting is Applicative Block, but we don't have a class for
Block reads yet, so we can't make the test polymorphic.
2011-10-22 15:37:18 +04:00
Lennart Kolmodin
8ce95bb417 Update .cabal file. Add source-repository and better docs. 2011-10-22 15:30:32 +04:00
Lennart Kolmodin
efad76d99b Use another version of BSD3 license file. 2011-10-22 14:47:41 +04:00
Lennart Kolmodin
1501bee59a Improve docs, fix -Wall and reorder code. 2011-10-22 14:46:20 +04:00
Lennart Kolmodin
778d22ce10 Clean up test suite. 2011-10-22 14:46:05 +04:00
Lennart Kolmodin
0c16997da6 Export the Block datatype (but not its internals). 2011-10-22 01:13:33 +04:00
Lennart Kolmodin
4fd6325e3d Declare extensions in .cabal. 2011-10-21 01:00:48 +04:00
Lennart Kolmodin
72d7b8a6f2 Export 'byteString'. 2011-10-21 01:00:28 +04:00
Lennart Kolmodin
48cdb374a1 Comments and haddock. 2011-10-21 01:00:12 +04:00
Lennart Kolmodin
8b458ac090 Comments. 2011-10-20 12:21:46 +04:00
Lennart Kolmodin
590ca5a7de Remove commented code (R structure). 2011-10-20 12:21:32 +04:00
Lennart Kolmodin
99e7da6d5e Tidy up export declaration. 2011-10-20 12:21:02 +04:00
Lennart Kolmodin
b7c49b11b1 Add test to read ByteStrings that start with random offsets.
Previously reading ByteStrings would always start at the next byte, ignoring
any partial byte it might be processing. Last patch fixed this and allows
reading at any offset without discarding any bits (although very expensive in
CPU). This new test reads and writes ByteStrings interleaved with other random
bits thus verifying this new functionality.
2011-10-12 00:33:29 +04:00
Lennart Kolmodin
1765d50f56 Simplify internal of monad, implement Applicative.
Turned the monad into a simple state monad.
Implemented a data type 'Block' which represents a block of data that is
bounded in size and thus can be read with only one bound check.
Implemented Applicative for the 'Block' data type. GHC is even clever enough to
calculate the total size at compile time. Neat!
Read Blocks with the new 'block' function.
2011-10-12 00:25:19 +04:00
Lennart Kolmodin
8449c3d6e4 Remove error handling continuation. 2011-10-01 01:57:41 +04:00
Lennart Kolmodin
f84b4eaacd Fix import of new namespace in QC tests 2011-06-08 23:12:06 +04:00
Lennart Kolmodin
52aa5f17b1 Implement naive way to putByteString 2011-06-05 14:56:11 +04:00
Lennart Kolmodin
f723509cc0 Comment 2011-06-05 14:56:02 +04:00
Lennart Kolmodin
52d7f53dcd Provide getByteString 2011-06-04 01:35:52 +04:00
Lennart Kolmodin
36635b2dac Move into new module names 2011-06-04 01:35:06 +04:00
Lennart Kolmodin
8bb6f37f03 Need to set default-language when forcing cabal-1.10
Setting it to Haskell98
2011-06-02 02:44:43 +04:00
Lennart Kolmodin
771f4b233f Make ensureBits pull just enough bytes from binary
Previously we let ensureBits take the internal state from binary (a
bytestring chunk) but the master branch of binary does not allow this.
Instead, read exactly as many bytes we need, each time we need something.
2011-06-01 10:13:03 +04:00
Lennart Kolmodin
0285c99779 Comments. 2011-06-01 10:11:49 +04:00
Lennart Kolmodin
9ac25638c9 test-suite stanza requires cabal 1.10 2011-06-01 10:05:39 +04:00
Lennart Kolmodin
4cd365b613 Disable joinGet
This feature relies on that you can take/set the internal state of the binary
monad, something which we currently do not allow in the main branch.
2011-06-01 08:42:50 +04:00
Lennart Kolmodin
6e65de69aa Add type signatures for readWith(out)Offset 2011-06-01 08:32:33 +04:00
Lennart Kolmodin
d259c3a2db Override default QC 2.4 Arbitrary instance
In previous QC versions we had to declare our own instances of Arbitrary for
Word8/Word16/Word32/Word64. This suited us well, as we want to implement our
own shrinking method. In this patch we're working around these instances with
the W datatype, a wrapper for the datatypes we're interested in.
2011-06-01 08:28:24 +04:00
Lennart Kolmodin
5a9c73664a Use default test-framework parameters, no override 2011-06-01 08:26:33 +04:00
Lennart Kolmodin
a43f3aef96 Rename 2011-05-26 23:22:45 +04:00
Lennart Kolmodin
5d141b0f47 Don't need GADTs language extension any more 2010-08-28 20:15:29 +04:00
Lennart Kolmodin
7ad3838d08 Fix bug in getWord32be and getWord64be 2010-08-27 18:35:58 +04:00
Lennart Kolmodin
7a56f9ef5d Enable get/putWord64be, add BinaryBit instance, enable tests 2010-08-27 18:20:00 +04:00
Lennart Kolmodin
70687bc3e5 Use HPC for tests 2010-08-27 17:06:54 +04:00
Lennart Kolmodin
d676204bd4 Implement putWord64be naively 2010-08-27 17:06:32 +04:00
Lennart Kolmodin
4d12f0ba1b Implement joinGet and joinPut
Allows to run the regular binary monads within the bitlevel monads.
2010-08-27 17:04:18 +04:00
Lennart Kolmodin
554c906d0c Reorder exports in BitGet and cleanup a bit 2010-08-27 17:03:19 +04:00
Lennart Kolmodin
2d75d41c2f Add more tests
- Compare the bitlevel get/put with a naive version that only gets/puts
    one bit at a time.
  - Compare the bitlevel get/put with the binary get/put for whole words.
2010-08-27 17:01:09 +04:00
Lennart Kolmodin
856e4d3678 Use test-framework to handles tests 2010-08-26 23:56:27 +04:00
Lennart Kolmodin
db823eb431 Simple implementation of putWord32be 2010-08-26 23:55:46 +04:00
Lennart Kolmodin
2f10d64b9c Implement a shrinker for Word[8,16,32,64]
Works by trying to more intelligently shift and clear bits to make the
numbers as small as possible. This is much faster than the old approach.
2010-08-26 22:30:30 +04:00
Lennart Kolmodin
1c8ef4810f Add Setup.hs and LICENSE 2010-08-26 22:28:36 +04:00
Lennart Kolmodin
19e2e50c60 Add test to utility test functions 2010-08-26 18:49:14 +04:00
Lennart Kolmodin
a4d37b9b05 Simplify tests by using the BinaryBit type class 2010-08-26 18:41:05 +04:00
Lennart Kolmodin
352913f332 Add module Bits, with BinaryBit class and instances 2010-08-26 18:40:22 +04:00