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

SJ

Copyright (C) 2019-2025  Anonymous

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

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)]

//! # Tests

use {
    crate::Result,
    super::Number,
};

mod number_writer;

#[test]
fn tests() -> Result<()> {
    for n in (u64::MIN..9).map(|n| u64::MAX - n) {
        let number = Number::from(n);
        assert_eq!(number.as_u64(), n);
    }
    for n in (0_i64..9).map(|n| i64::MIN + n) {
        let number = Number::from(n);
        assert_eq!(number.as_i64(), n);
    }
    for n in (u128::MIN..9).map(|n| u128::MAX - n) {
        let number = Number::from(n);
        assert_eq!(number.as_u128(), n);
    }
    for n in (0_i128..9).map(|n| i128::MIN + n) {
        let number = Number::from(n);
        assert_eq!(number.as_i128(), n);
    }
    for n in (-9_i8..9).map(|n| f32::from(n)) {
        let number = Number::from(n);
        assert_eq!(number.as_f32(), n);
    }
    for n in (-9_i8..9).map(|n| f64::from(n)) {
        let number = Number::from(n);
        assert_eq!(number.as_f64(), n);
    }

    Ok(())
}