Wrap rhs in ident function
This commit is contained in:
parent
256cf8681e
commit
e54c5a9e48
1 changed files with 12 additions and 8 deletions
|
@ -18,13 +18,17 @@ const TO_BE_BYTES: [u8; 4] = 0x12_34_56_78_i32.to_be_bytes();
|
|||
const TO_LE_BYTES: [u8; 4] = 0x12_34_56_78_i32.to_le_bytes();
|
||||
const TO_NE_BYTES: [u8; 4] = i32::min_value().to_be().to_ne_bytes();
|
||||
|
||||
fn main() {
|
||||
assert_eq!(REVERSE, 0x1e6a2c48);
|
||||
assert_eq!(FROM_BE_BYTES, 0x12_34_56_78);
|
||||
assert_eq!(FROM_LE_BYTES, 0x78_56_34_12);
|
||||
assert_eq!(FROM_NE_BYTES, i32::min_value());
|
||||
assert_eq!(TO_BE_BYTES, [0x12, 0x34, 0x56, 0x78]);
|
||||
assert_eq!(TO_LE_BYTES, [0x78, 0x56, 0x34, 0x12]);
|
||||
assert_eq!(TO_NE_BYTES, [0x80, 0, 0, 0]);
|
||||
fn ident<T>(ident: T) -> T {
|
||||
ident
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(REVERSE, ident(0x1e6a2c48));
|
||||
assert_eq!(FROM_BE_BYTES, ident(0x12_34_56_78));
|
||||
assert_eq!(FROM_LE_BYTES, ident(0x78_56_34_12));
|
||||
assert_eq!(FROM_NE_BYTES, ident(i32::min_value()));
|
||||
assert_eq!(TO_BE_BYTES, ident([0x12, 0x34, 0x56, 0x78]));
|
||||
assert_eq!(TO_LE_BYTES, ident([0x78, 0x56, 0x34, 0x12]));
|
||||
assert_eq!(TO_NE_BYTES, ident([0x80, 0, 0, 0]));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue