Implemented unsigned int comparisons.

This commit is contained in:
Jared Cone 2022-04-24 14:42:02 -07:00
parent 2ab0bc1226
commit c0780aad92
No known key found for this signature in database
GPG key ID: 99D4217479603EA1
2 changed files with 108 additions and 4 deletions

View file

@ -1210,6 +1210,86 @@ fn bitwise_or() {
assert_evals_to!("Num.bitwiseOr 1 2", 3, i64);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn lt_u8() {
assert_evals_to!("1u8 < 2u8", true, bool);
assert_evals_to!("1u8 < 1u8", false, bool);
assert_evals_to!("2u8 < 1u8", false, bool);
assert_evals_to!("0u8 < 0u8", false, bool);
assert_evals_to!("128u8 < 0u8", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn lte_u8() {
assert_evals_to!("1u8 <= 1u8", true, bool);
assert_evals_to!("2u8 <= 1u8", false, bool);
assert_evals_to!("1u8 <= 2u8", true, bool);
assert_evals_to!("0u8 <= 0u8", true, bool);
assert_evals_to!("128u8 <= 0u8", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn gt_u8() {
assert_evals_to!("2u8 > 1u8", true, bool);
assert_evals_to!("2u8 > 2u8", false, bool);
assert_evals_to!("1u8 > 1u8", false, bool);
assert_evals_to!("0u8 > 0u8", false, bool);
assert_evals_to!("0u8 > 128u8", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn gte_u8() {
assert_evals_to!("1u8 >= 1u8", true, bool);
assert_evals_to!("1u8 >= 2u8", false, bool);
assert_evals_to!("2u8 >= 1u8", true, bool);
assert_evals_to!("0u8 >= 0u8", true, bool);
assert_evals_to!("0u8 >= 128u8", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn lt_u64() {
assert_evals_to!("1u64 < 2u64", true, bool);
assert_evals_to!("1u64 < 1u64", false, bool);
assert_evals_to!("2u64 < 1u64", false, bool);
assert_evals_to!("0u64 < 0u64", false, bool);
assert_evals_to!("9223372036854775808u64 < 0u64", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn lte_u64() {
assert_evals_to!("1u64 <= 1u64", true, bool);
assert_evals_to!("2u64 <= 1u64", false, bool);
assert_evals_to!("1u64 <= 2u64", true, bool);
assert_evals_to!("0u64 <= 0u64", true, bool);
assert_evals_to!("9223372036854775808u64 <= 0u64", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn gt_u64() {
assert_evals_to!("2u64 > 1u64", true, bool);
assert_evals_to!("2u64 > 2u64", false, bool);
assert_evals_to!("1u64 > 1u64", false, bool);
assert_evals_to!("0u64 > 0u64", false, bool);
assert_evals_to!("0u64 > 9223372036854775808u64", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn gte_u64() {
assert_evals_to!("1u64 >= 1u64", true, bool);
assert_evals_to!("1u64 >= 2u64", false, bool);
assert_evals_to!("2u64 >= 1u64", true, bool);
assert_evals_to!("0u64 >= 0u64", true, bool);
assert_evals_to!("0u64 >= 9223372036854775808u64", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn lt_i64() {