Documentation
/*
==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

Bi

Copyright (C) 2019, 2021-2022, 2024  Anonymous

There are several releases over multiple years,
they are listed as ranges, such as: "2021-2022".

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--
*/

#![cfg(test)]

use {
    core::sync::atomic::AtomicUsize,
    std::sync::Arc,
    crate::ATOMIC_ORDERING,
    super::Bytes,
};

#[test]
fn bytes() {
    let (bytes, counter) = {
        let bytes = vec![0];
        let counter = Arc::new(AtomicUsize::new(bytes.len()));
        (Bytes::new(bytes, counter.clone()), counter)
    };

    let bytes = <Vec<u8>>::from(bytes);
    assert_eq!(bytes, &[0]);
    assert_eq!(counter.load(ATOMIC_ORDERING), 0);
}