Skip to content

Commit 6b6ca2f

Browse files
committed
serdect: test that no packing is happening for byte values
1 parent abe13c5 commit 6b6ca2f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

serdect/tests/bincode.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ use proptest::{array::*, collection::vec, prelude::*};
77
use serdect::{array, slice};
88

99
/// Example input to be serialized.
10-
const EXAMPLE_BYTES: [u8; 16] = hex!("000102030405060708090A0B0C0D0E0F");
10+
/// Last byte is `0xFF` to test that no packing is performed for values under 128.
11+
const EXAMPLE_BYTES: [u8; 16] = hex!("000102030405060708090A0B0C0D0EFF");
1112

1213
/// bincode serialization of [`EXAMPLE_BYTES`] as a slice.
13-
const BINCODE_SLICE: [u8; 24] = hex!("1000000000000000000102030405060708090A0B0C0D0E0F");
14+
const BINCODE_SLICE: [u8; 24] = hex!("1000000000000000000102030405060708090A0B0C0D0EFF");
1415

1516
/// bincode serialization of [`EXAMPLE_BYTES`] as an array.
1617
const BINCODE_ARRAY: [u8; 16] = EXAMPLE_BYTES;

serdect/tests/cbor.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ use serde::Serialize;
99
use serdect::{array, slice};
1010

1111
/// Example input to be serialized.
12-
const EXAMPLE_BYTES: [u8; 16] = hex!("000102030405060708090A0B0C0D0E0F");
12+
/// Last byte is `0xFF` to test that no packing is performed for values under 128.
13+
const EXAMPLE_BYTES: [u8; 16] = hex!("000102030405060708090A0B0C0D0EFF");
1314

1415
/// CBOR serialization of [`EXAMPLE_BYTES`] as a slice.
1516
/// (first three bits, `0b010` denote a byte string, and the last five, `0b10000` denote the length)
16-
const CBOR_SLICE: [u8; 17] = hex!("50000102030405060708090A0B0C0D0E0F");
17+
const CBOR_SLICE: [u8; 17] = hex!("50000102030405060708090A0B0C0D0EFF");
1718

1819
/// CBOR serialization of [`EXAMPLE_BYTES`] as an array.
1920
/// (first three bits, `0b100` denote an array, and the last five, `0b10000` denote the length)
20-
const CBOR_ARRAY: [u8; 17] = hex!("90000102030405060708090A0B0C0D0E0F");
21+
const CBOR_ARRAY: [u8; 17] = hex!("90000102030405060708090A0B0C0D0EFF");
2122

2223
#[test]
2324
fn deserialize_slice() {

0 commit comments

Comments
 (0)