Skip to main content

crabka_protocol/owned/
txn_offset_commit_request.rs

1// AUTO-GENERATED by crabka-protocol-codegen against a9ce3221537b8653448750697915607dc7936cf3. Do not edit.
2// Clippy lints that fire on generated code patterns are suppressed here so
3// that regenerating the file does not require manual allow annotations.
4#![allow(
5    clippy::absurd_extreme_comparisons,
6    clippy::double_comparisons,
7    clippy::elidable_lifetime_names,
8    clippy::manual_string_new,
9    clippy::must_use_candidate,
10    clippy::unnecessary_wraps,
11    clippy::cast_sign_loss,
12    clippy::cast_possible_truncation,
13    clippy::cast_possible_wrap,
14    clippy::default_trait_access,
15    clippy::derivable_impls,
16    clippy::collapsible_if,
17    clippy::new_without_default,
18    clippy::unreadable_literal,
19    clippy::redundant_closure_for_method_calls,
20    clippy::nonminimal_bool,
21    clippy::bool_comparison,
22    clippy::map_unwrap_or,
23    clippy::option_as_ref_deref,
24    clippy::manual_range_contains,
25    clippy::borrow_deref_ref,
26    clippy::explicit_auto_deref,
27    clippy::unnecessary_semicolon,
28    unused_imports,
29    unused_variables
30)]
31
32include!(concat!(
33    env!("CARGO_MANIFEST_DIR"),
34    "/generated/TxnOffsetCommitRequest.owned.rs"
35));
36
37#[cfg(test)]
38mod tests {
39    use super::*;
40    use crate::{Decode, Encode};
41    use bytes::BytesMut;
42
43    #[test]
44    fn min_version_roundtrips() {
45        let v = MIN_VERSION;
46        let msg = TxnOffsetCommitRequest::default();
47        let mut buf = BytesMut::new();
48        msg.encode(&mut buf, v).unwrap();
49        assert_eq!(msg.encoded_len(v), buf.len());
50        let mut cur = &buf[..];
51        let _decoded = TxnOffsetCommitRequest::decode(&mut cur, v).unwrap();
52        assert!(cur.is_empty(), "decoder left trailing bytes");
53    }
54
55    #[test]
56    fn max_version_roundtrips() {
57        let v = MAX_VERSION;
58        let msg = TxnOffsetCommitRequest::default();
59        let mut buf = BytesMut::new();
60        msg.encode(&mut buf, v).unwrap();
61        assert_eq!(msg.encoded_len(v), buf.len());
62        let mut cur = &buf[..];
63        let decoded = TxnOffsetCommitRequest::decode(&mut cur, v).unwrap();
64        assert_eq!(decoded, msg);
65        assert!(cur.is_empty(), "decoder left trailing bytes");
66    }
67}