dia-semver 11.0.1

For handling Semantic Versions 2.0.0
Documentation
/*
==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

Dia-Semver

Copyright (C) 2018-2022  Anonymous

There are several releases over multiple years,
they are listed as ranges, such as: "2018-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::str::FromStr,
    super::{Semver, parse_errors},
};

#[test]
fn parser() {
    #[cfg(target_pointer_width = "8")]
    assert_eq!(super::MAX_INPUT_STR_LEN, 255_usize);

    #[cfg(not(target_pointer_width = "8"))]
    assert_eq!(super::MAX_INPUT_STR_LEN, 2048_usize);

    let zeros = concat!('0').repeat(super::MAX_INPUT_STR_LEN);
    assert_eq!(Semver::from_str(&alloc::format!("0.0.0+{}", zeros)).unwrap_err().msg().unwrap(), parse_errors::TOO_LARGE);
}