Elm Exactly
Results /

elm-bytes

elm/bytes encoders and decoders

Discussions of this project and its tests ↓

Showing 88 of 88 tests. Hover over a badge for the reason.

Testelm-0.19.1elm-0.19.2elm-0.19.3lamdera-1.5.0
BytesDecodeFloat64RoundtripTest
A Float encoded with `Bytes.Encode.float64` little-endian decodes back to exactly the same Float.
passpasspasspass
BytesDecodeI32RoundtripTest
An Int encoded with `Bytes.Encode.unsignedInt32` big-endian decodes back to the same Int with `Bytes.Decode.unsignedInt32`.
passpasspasspass
BytesDecoderMixedCycleTwoFunctionsTest
A recursive cycle of one top-level decoder value and two top-level decoder functions decodes a tagged list of bytes correctly.
passpasspasspass
BytesDecoderMixedCycleTwoValuesTest
A recursive cycle of two top-level decoder values and one top-level decoder function decodes a tagged tree correctly.
passpasspasspass
BytesDecoderMutualRecursiveTest
A self-recursive top-level decoder that also delegates to a second top-level decoder decodes a small expression tree correctly.
passpasspasspass
BytesDecoderSelfRecursiveMinimalTest
A top-level decoder value that refers to itself inside `Bytes.Decode.andThen` decodes a small tree correctly.
passpasspasspass
BytesHostEndiannessTest
`Bytes.getHostEndianness` is a `Task` that succeeds with an `Endianness`, `LE` on a little-endian machine.
passpasspasspass
BytesIssue15BytesEqualityTestelm19-bug
`==` on two `Bytes` values is always True.
failfailfailfail
BytesIssue20InvalidUtf8StringTestelm19-bug
`Bytes.Decode.string` decodes invalid UTF-8 into a nonsense string.
failfailfailfail
BytesIssue9DecoderSwallowsExceptionTestelm19-bug
`Bytes.Decode.decode` turns any exception thrown inside a decoder into `Nothing`.
failfailfailfail
BytesLargeHeterogeneousBufferTest
A mixed-width encoding of about 12 KB has the right width, and its first values decode correctly.
passpasspasspass
BytesSliceOpMatrixTest
Decoding unsigned 8-, 16- and 32-bit integers from a 40-byte `Bytes` value produced by `Bytes.Decode.bytes` reads from the start of that value.
passpasspasspass
BytesSliceViewTest
Decoding a big-endian unsigned 32-bit integer from a 40-byte `Bytes` value produced by `Bytes.Decode.bytes` gives the first four bytes of that value.
passpasspasspass
BytesWidthOfSliceTest
`Bytes.width` of the `Bytes` value that `Bytes.Decode.bytes 40` takes from a 50-byte buffer is 40.
passpasspasspass
BytesWidthTest
`Bytes.width` gives 1, 2, 4 and 8 for the encodings of an unsigned 8-bit integer, a big-endian unsigned 16-bit and 32-bit integer, and a big-endian 64-bit float.
passpasspasspass
DecodeAndThenTest
`Bytes.Decode.andThen` lets a value already decoded choose the next decoder: a length byte followed by that many bytes of string decodes to `"Hi"`.
passpasspasspass
DecodeBytesTest
`Bytes.Decode.bytes 3` takes the first three bytes of a five-byte sequence as a `Bytes` value of width 3.
passpasspasspass
DecodeEmptyBytesTest
Decoding an unsigned 8-bit integer from an empty byte sequence returns `Nothing`.
passpasspasspass
DecodeFailTest
`Bytes.Decode.fail` makes `decode` return `Nothing` even when there are bytes left to read.
passpasspasspass
DecodeFloat32BETest
`Bytes.Decode.float32 BE` reads back a 32-bit big-endian float written by `Bytes.Encode.float32 BE`.
passpasspasspass
DecodeFloat64BETest
`Bytes.Decode.float64 BE` reads back a 64-bit big-endian float written by `Bytes.Encode.float64 BE`, with every digit of `3.141592653589793` intact.
passpasspasspass
DecodeInsufficientBytesTest
Decoding a 32-bit unsigned integer from a single byte returns `Nothing` rather than a partial value.
passpasspasspass
DecodeListMaybeTest
A list of `Maybe` records, mixing `Just` and `Nothing`, survives encoding to bytes and decoding back unchanged.
passpasspasspass
DecodeLoopTest
`Bytes.Decode.loop` repeats a step decoder until it returns `Done`: three steps over the bytes 1, 2 and 3 sum them to 6.
passpasspasspass
DecodeMap2Test
`Bytes.Decode.map2` combines two decoders in order: two bytes, 100 and 200, decoded and added with `(+)` give the `Int` 300.
passpasspasspass
DecodeMap3Test
`Bytes.Decode.map3` combines three decoders in order, adding three unsigned bytes.
passpasspasspass
DecodeMap4Test
Bytes.Decode.map4 combines four decoders that read consecutive bytes.
passpasspasspass
DecodeMap5Test
Bytes.Decode.map5 combines five decoders that read consecutive bytes.
passpasspasspass
DecodeMapTest
Bytes.Decode.map applies a function to the value a decoder produces.
passpasspasspass
DecodeMixedTupleRoundtripTest
A `( Int, String )` tuple survives a round trip through Bytes.Encode and Bytes.Decode.
passpasspasspass
DecodeNegativeLengthTest
Bytes.Decode.bytes given a negative length fails the decode, giving `Nothing`.
passpasspasspass
DecodeSignedInt16BETest
Bytes.Decode.signedInt16 BE reads back a negative value written by Bytes.Encode.signedInt16 BE.
passpasspasspass
DecodeSignedInt32BETest
Bytes.Decode.signedInt32 BE reads back a negative value written by Bytes.Encode.signedInt32 BE.
passpasspasspass
DecodeSignedInt8Test
Bytes.Decode.signedInt8 reads back a negative value written by Bytes.Encode.signedInt8.
passpasspasspass
DecodeStringEmptyTest
Bytes.Decode.string 0 decodes the empty string.
passpasspasspass
DecodeStringNonAsciiTest
Bytes.Decode.string round-trips non-ASCII text, and the decoded strings have the right `String.length`.
passpasspasspass
DecodeStringReprMatrixTest
Bytes.Decode.string round-trips ASCII strings of several lengths, and String operations on a decoded string agree with the same operations on a literal.
passpasspasspass
DecodeStringTest
Bytes.Decode.string reads back a string written by Bytes.Encode.string.
passpasspasspass
DecodeStringUtf8ViewTest
A string produced by Bytes.Decode.string behaves like a string literal with the same contents under the String API and as a Dict key.
passpasspasspass
DecodeSucceedTest
Bytes.Decode.succeed produces its value without reading the input.
passpasspasspass
DecodeUnsignedInt16BETest
Bytes.Decode.unsignedInt16 BE reads back a value written by Bytes.Encode.unsignedInt16 BE.
passpasspasspass
DecodeUnsignedInt16LETest
Bytes.Decode.unsignedInt16 LE reads back a value written by Bytes.Encode.unsignedInt16 LE.
passpasspasspass
DecodeUnsignedInt32BETest
Bytes.Decode.unsignedInt32 BE reads back a value written by Bytes.Encode.unsignedInt32 BE.
passpasspasspass
DecodeUnsignedInt32LETest
Bytes.Decode.unsignedInt32 LE reads back a value written by Bytes.Encode.unsignedInt32 LE.
passpasspasspass
DecodeUnsignedInt8Test
Bytes.Decode.unsignedInt8 reads back a byte written by Bytes.Encode.unsignedInt8.
passpasspasspass
DecodedStringAsKeyTest
Strings produced by Bytes.Decode.string work as Dict keys that are found by equal strings built without decoding.
passpasspasspass
EncodeBytesTest
Bytes.Encode.bytes embeds an existing Bytes value in a new encoding.
passpasspasspass
EncodeDecodeStringAstralTest
A string containing a character outside the Basic Multilingual Plane survives a round trip through Bytes.Encode.string and Bytes.Decode.string.
passpasspasspass
EncodeDecodeStringUnicodeContentTest
A string with two- and three-byte UTF-8 characters survives a round trip through `Bytes.Encode.string` and `Bytes.Decode.string`.
passpasspasspass
EncodeFloat32BETest
`Bytes.Encode.float32` with big-endian order writes 4 bytes.
passpasspasspass
EncodeFloat32LETest
`Bytes.Encode.float32` with little-endian order writes 4 bytes.
passpasspasspass
EncodeFloat64BETest
`Bytes.Encode.float64` with big-endian order writes 8 bytes.
passpasspasspass
EncodeLargeSequenceTest
`Bytes.Encode.sequence` of 100 `unsignedInt8` encoders produces 100 bytes.
passpasspasspass
EncodeNestedSequenceTest
A `Bytes.Encode.sequence` that contains other sequences produces the sum of all their widths.
passpasspasspass
EncodeSequenceEmptyTest
`Bytes.Encode.sequence []` produces zero bytes.
passpasspasspass
EncodeSequenceTest
`Bytes.Encode.sequence` of mixed-width encoders produces the sum of their widths.
passpasspasspass
EncodeSignedInt16BETest
`Bytes.Encode.signedInt16` with big-endian order writes 2 bytes for a negative value.
passpasspasspass
EncodeSignedInt32BETest
`Bytes.Encode.signedInt32` with big-endian order writes 4 bytes for a negative value.
passpasspasspass
EncodeSignedInt8Test
`Bytes.Encode.signedInt8` writes 1 byte for a negative value.
passpasspasspass
EncodeStringEmptyTest
`Bytes.Encode.string ""` produces zero bytes.
passpasspasspass
EncodeStringTest
`Bytes.Encode.string` writes one byte per ASCII character.
passpasspasspass
EncodeStringUnicodeTest
`Bytes.Encode.string` writes a string as UTF-8, so a two-byte character takes two bytes.
passpasspasspass
EncodeUnsignedInt16BETest
`Bytes.Encode.unsignedInt16` with big-endian order writes 2 bytes.
passpasspasspass
EncodeUnsignedInt16LETest
`Bytes.Encode.unsignedInt16` with little-endian order writes 2 bytes.
passpasspasspass
EncodeUnsignedInt32BETest
`Bytes.Encode.unsignedInt32` with big-endian order writes 4 bytes.
passpasspasspass
EncodeUnsignedInt32LETest
`Bytes.Encode.unsignedInt32` with little-endian order writes 4 bytes.
passpasspasspass
EncodeUnsignedInt8MaxTest
`Bytes.Encode.unsignedInt8` writes 1 byte for its largest value, 255.
passpasspasspass
EncodeUnsignedInt8Test
`Bytes.Encode.unsignedInt8` writes 1 byte.
passpasspasspass
EncodeUnsignedInt8ZeroTest
`Bytes.Encode.unsignedInt8` writes 1 byte for zero.
passpasspasspass
EndiannessBELETest
Encoding a 16-bit unsigned integer in one byte order and decoding it in the other with elm/bytes swaps its two bytes.
passpasspasspass
FloatSpecialValuesTest
Positive infinity, negative infinity and zero survive a big-endian `float64` encode and decode with elm/bytes.
passpasspasspass
IntegrationBinaryProtocolTest
A small binary message format round-trips through elm/bytes: a version byte, a type byte, a big-endian 16-bit payload length, then the payload bytes.
passpasspasspass
IntegrationConditionalDecodingTest
A decoder that reads a tag byte and uses `Bytes.Decode.andThen` to choose between a 32-bit integer and a 64-bit float decodes both variants of a custom type.
passpasspasspass
IntegrationLengthPrefixedStringTest
A string prefixed by its length as a big-endian 16-bit integer round-trips through elm/bytes, with `Bytes.Decode.andThen` passing the decoded length to `Bytes.Decode.string`.
passpasspasspass
IntegrationListEncodingTest
A list of integers encoded as a one-byte count followed by one byte per element round-trips through elm/bytes.
passpasspasspass
IntegrationMultipleStringsTest
Three strings, each prefixed by its length as one byte, are encoded one after another with elm/bytes and decoded back in order.
passpasspasspass
IntegrationNestedStructureTest
A record containing another record round-trips through elm/bytes using encoders and decoders composed from per-record parts.
passpasspasspass
IntegrationRecordEncodingTest
A record of two bytes and a 32-bit float round-trips through elm/bytes, decoded with `Bytes.Decode.map3`.
passpasspasspass
RoundtripFloat32Test
Floats survive a big-endian `float32` encode and decode with elm/bytes to within 0.0001.
passpasspasspass
RoundtripFloat64Test
Floats survive a big-endian `float64` encode and decode with elm/bytes exactly.
passpasspasspass
RoundtripMixedTypesTest
A sequence of an 8-bit integer, a big-endian 16-bit integer and a big-endian 64-bit float is encoded with elm/bytes and decoded back with `Bytes.Decode.map3`.
passpasspasspass
RoundtripSignedInt16Test
Integers survive a big-endian `signedInt16` encode and decode with elm/bytes, including both ends of the signed 16-bit range.
passpasspasspass
RoundtripSignedInt32Test
Integers survive a big-endian `signedInt32` encode and decode with elm/bytes, including both ends of the signed 32-bit range.
passpasspasspass
RoundtripSignedInt8Test
Integers survive a `signedInt8` encode and decode with elm/bytes, including both ends of the signed 8-bit range.
passpasspasspass
RoundtripStringTest
Strings survive an elm/bytes encode and decode when `Bytes.Decode.string` is given the string's length.
passpasspasspass
RoundtripUnsignedInt16Test
Integers survive an `unsignedInt16` encode and decode with elm/bytes in both byte orders.
passpasspasspass
RoundtripUnsignedInt32Test
Integers survive an `unsignedInt32` encode and decode with elm/bytes in both byte orders.
passpasspasspass
RoundtripUnsignedInt8Test
Integers survive an `unsignedInt8` encode and decode with elm/bytes, from 0 up to 255.
passpasspasspass

Discussions

Discuss this project·Search the discussions on GitHub

Discussions are on GitHub; one about this project has [p:elm-bytes] in its title.