use super::*;
use assert2::assert;
type Range<const START: u64, const END: u64> = RiU64<START, END>;
#[test]
const fn const_range_contains_in_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
const POPULATION_TODAY: u64 = 7_923_619_609;
const EXPECTED: bool = true;
const RESULT: bool = Sut::contains(&POPULATION_TODAY);
std::assert!(RESULT == EXPECTED);
}
#[test]
const fn const_range_contains_min_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
const YEAR_2000: u64 = 6_143_493_823;
const EXPECTED: bool = true;
const RESULT: bool = Sut::contains(&YEAR_2000);
std::assert!(RESULT == EXPECTED);
}
#[test]
const fn const_range_contains_max_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
const YEAR_2100: u64 = 10_875_393_719;
const EXPECTED: bool = true;
const RESULT: bool = Sut::contains(&YEAR_2100);
std::assert!(RESULT == EXPECTED);
}
#[test]
const fn const_range_does_not_contain_low_out_of_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
const POPULATION_TODAY: u64 = 6_143_493_822;
const EXPECTED: bool = false;
const RESULT: bool = Sut::contains(&POPULATION_TODAY);
std::assert!(RESULT == EXPECTED);
}
#[test]
const fn const_range_does_not_contain_high_out_of_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
const POPULATION_TODAY: u64 = 10_875_393_720;
const EXPECTED: bool = false;
const RESULT: bool = Sut::contains(&POPULATION_TODAY);
std::assert!(RESULT == EXPECTED);
}
#[test]
fn range_contains_in_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
let population_today: u64 = 7_923_619_609;
let expected = true;
let result = Sut::contains(&population_today);
assert!(result == expected);
}
#[test]
fn range_contains_min_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
let year_2000: u64 = 6_143_493_823;
let expected = true;
let result = Sut::contains(&year_2000);
assert!(result == expected);
}
#[test]
fn range_contains_max_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
let year_2100: u64 = 10_875_393_719;
let expected = true;
let result = Sut::contains(&year_2100);
assert!(result == expected);
}
#[test]
fn range_does_not_contain_low_out_of_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
let population_today: u64 = 6_143_493_822;
let expected = false;
let result = Sut::contains(&population_today);
assert!(result == expected);
}
#[test]
fn range_does_not_contain_high_out_of_bounds_value() {
const WORLD_POPULATION_AT_START_OF_CENTURY: u64 = 6_143_493_823;
const WORLD_POPULATION_AT_END_OF_CENTURY: u64 = 10_875_393_719;
type Sut = Range<WORLD_POPULATION_AT_START_OF_CENTURY, WORLD_POPULATION_AT_END_OF_CENTURY>;
let population_today: u64 = 10_875_393_720;
let expected = false;
let result = Sut::contains(&population_today);
assert!(result == expected);
}