oct 0.26.0

Octonary transcodings.
Documentation
// Copyright 2024-2025 Gabriel Bjørnager Jensen.
//
// This Source Code Form is subject to the terms of
// the Mozilla Public License, v. 2.0. If a copy of
// the MPL was not distributed with this file, you
// can obtain one at:
// <https://mozilla.org/MPL/2.0/>.

//! Tests for [`Bytes`].
//!
//! [`Bytes`]: crate::io::Bytes

#![cfg(test)]

use oct::IntoOcts;
use oct::io::Read;

#[test]
fn test_bytes() {
	let src = const { u128::from_be(0x00_11_22_33_44_55_66_77_88_99_AA_BB_CC_DD_EE_FF) }.as_octs();

	let mut bytes = src.bytes();

	assert_eq!(bytes.next().map(Result::unwrap), Some(0x00));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x11));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x22));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x33));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x44));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x55));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x66));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x77));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x88));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0x99));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0xAA));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0xBB));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0xCC));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0xDD));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0xEE));
	assert_eq!(bytes.next().map(Result::unwrap), Some(0xFF));

	assert_eq!(bytes.next().map(Result::unwrap), None);
}