Commit Graph

36 Commits

Author SHA1 Message Date
Sylvain HENRY
858e615896 Add support for byte alignment and bit skip 2015-03-06 20:40:36 +01:00
Sylvain HENRY
4c202bbffb Add tests and fix bugs 2015-03-06 20:13:45 +01:00
Sylvain Henry
cb2cbc45f2 Deprecate putWord*be 2015-03-06 14:53:53 +01:00
Sylvain HENRY
47cca38b2f Fix warning 2015-03-02 01:04:06 +01:00
Lennart Kolmodin
ac8e0cab6f tests: Also test Bools in program simulation 2013-04-06 14:10:13 +04:00
Lennart Kolmodin
0d2d17e8a9 tests: Add isEmpty to simulation 2013-04-01 23:05:19 +04:00
Lennart Kolmodin
9280cfae6d tests: Add simulations of BitGet programs 2013-04-01 21:26:55 +04:00
Lennart Kolmodin
2cc392f62e Merge branch 'master' of ssh://github.com/kolmodin/binary-bits 2013-03-31 23:56:06 +04:00
Alexander Polakov
bec131cdb3 Fix isEmpty tests
- remove stupid Bool comparisons
 - no need for numeric parameter in prop_isEmptyOfConsumedEmpty

 suggested by @kolmodin
2013-03-31 16:40:56 +04:00
Lennart Kolmodin
7763587d6c tests: remove unused imports, fix some lints 2013-03-30 23:53:18 +04:00
Alexander Polakov
22c8278ad6 Add isEmpty 2013-03-29 06:22:29 +04:00
Alexander Polakov
dc3e9095a4 Make getLazyByteString read from current byte 2013-03-29 06:22:28 +04:00
Lennart Kolmodin
c0fcafbb73 Make tests compile with GHC 7.6.1 too. 2012-10-28 15:03:08 +04:00
Lennart Kolmodin
3cebf6c4e4 Port tests to binary >= 0.6.0.0. 2012-10-28 15:02:08 +04:00
Lennart Kolmodin
fe6389e97a Add tests regarding failure and that BitGet has the current chunk. 2012-04-25 21:42:03 +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
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
778d22ce10 Clean up test suite. 2011-10-22 14:46:05 +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
f84b4eaacd Fix import of new namespace in QC tests 2011-06-08 23:12:06 +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
7a56f9ef5d Enable get/putWord64be, add BinaryBit instance, enable tests 2010-08-27 18:20:00 +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
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
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
4b75399ed5 Cleanup in tests 2010-08-26 17:24:53 +04:00
Lennart Kolmodin
6a0ad9d770 Reimplement some old tests
Port from R structure to monads
2010-08-26 17:19:02 +04:00
Lennart Kolmodin
1467419c82 Comment out the R structure, only monads left 2010-08-24 22:15:29 +04:00
Lennart Kolmodin
4556008a65 Fix compile error in tests 2010-08-24 22:14:10 +04:00
Lennart Kolmodin
53204a2307 Two more QuickCheck tests
* Write a list of bools and read it back
 * Write a list of Word8s with variable numbers of bits, and read it back
2010-08-24 22:07:59 +04:00
Lennart Kolmodin
7cca4dfc3f Add some utility functions, improve the test suite with some random tests 2010-08-17 23:30:23 +04:00
Lennart Kolmodin
fa0393f134 Start of a bit parsing library
Can parse Bool, Word8, Word16 in big endian.
Also parses Word32 in big endian if it fits into a Word16.
Basic QuickCheck tests.
2010-08-17 01:33:18 +04:00