Skip to content

Commit

Permalink
Add par_encode/decode to some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Oct 14, 2023
1 parent a78d143 commit 0076846
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Breaking**: Added `CodecError::UnsupportedDataType`
- Added `array_subset::IncompatibleArrayShapeError`
- Added `array_subset::iter_linearised_indices_unchecked`
- Added parallel encoding/decoding to tests

### Changed
- **Breaking**: `array::data_type::DataType` is now marked `#[non_exhaustive]`
Expand Down
11 changes: 11 additions & 0 deletions src/array/codec/array_to_bytes/codec_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,17 @@ mod tests {
}
assert_eq!(bytes, decoded);

let encoded = codec
.par_encode(bytes.clone(), &array_representation)
.unwrap();
let decoded = codec
.par_decode(encoded.clone(), &array_representation)
.unwrap();
if not_just_bytes {
assert_ne!(encoded, decoded);
}
assert_eq!(bytes, decoded);

// println!("{} {}", encoded_chunk.len(), decoded_chunk.len());
}

Expand Down
12 changes: 12 additions & 0 deletions src/array/codec/array_to_bytes/sharding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ mod tests {
.unwrap();
assert_ne!(encoded, decoded);
assert_eq!(bytes, decoded);

// println!("bytes {bytes:?}");
let encoded = codec
.par_encode(bytes.clone(), &array_representation)
.unwrap();
// println!("encoded {encoded:?}");
let decoded = codec
.par_decode(encoded.clone(), &array_representation)
.unwrap();
// println!("decoded {decoded:?}");
assert_ne!(encoded, decoded);
assert_eq!(bytes, decoded);
}

#[test]
Expand Down

0 comments on commit 0076846

Please sign in to comment.