()
| 333 | |
| 334 | #[test] |
| 335 | fn compact_integer_encoding() { |
| 336 | // Positive fixint |
| 337 | let mut buf = Vec::new(); |
| 338 | write_i64(&mut buf, 42); |
| 339 | assert_eq!(buf, vec![42]); |
| 340 | |
| 341 | // Negative fixint |
| 342 | buf.clear(); |
| 343 | write_i64(&mut buf, -1); |
| 344 | assert_eq!(buf, vec![0xFF]); |
| 345 | |
| 346 | // int8 |
| 347 | buf.clear(); |
| 348 | write_i64(&mut buf, -100); |
| 349 | assert_eq!(buf, vec![0xD0, (-100i8) as u8]); |
| 350 | } |
| 351 | } |