mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Move int and uint overflow tests into macros
This commit is contained in:
parent
1388c053a8
commit
1f15d24243
@ -120,10 +120,3 @@ impl CheckedMul for int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_overflows() {
|
|
||||||
assert!((::int::MAX > 0));
|
|
||||||
assert!((::int::MIN <= 0));
|
|
||||||
assert!((::int::MIN + ::int::MAX + 1 == 0));
|
|
||||||
}
|
|
||||||
|
@ -445,6 +445,13 @@ mod tests {
|
|||||||
use num::CheckedDiv;
|
use num::CheckedDiv;
|
||||||
use num::Bitwise;
|
use num::Bitwise;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_overflows() {
|
||||||
|
assert!(MAX > 0);
|
||||||
|
assert!(MIN <= 0);
|
||||||
|
assert_eq!(MIN + MAX + 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_num() {
|
fn test_num() {
|
||||||
num::test_num(10 as $T, 2 as $T);
|
num::test_num(10 as $T, 2 as $T);
|
||||||
|
@ -90,11 +90,3 @@ impl CheckedMul for uint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_overflows() {
|
|
||||||
use uint;
|
|
||||||
assert!((uint::MAX > 0u));
|
|
||||||
assert!((uint::MIN <= 0u));
|
|
||||||
assert!((uint::MIN + uint::MAX + 1u == 0u));
|
|
||||||
}
|
|
||||||
|
@ -317,6 +317,13 @@ mod tests {
|
|||||||
use num::Bitwise;
|
use num::Bitwise;
|
||||||
use u16;
|
use u16;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_overflows() {
|
||||||
|
assert!(MAX > 0);
|
||||||
|
assert!(MIN <= 0);
|
||||||
|
assert_eq!(MIN + MAX + 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_num() {
|
fn test_num() {
|
||||||
num::test_num(10 as $T, 2 as $T);
|
num::test_num(10 as $T, 2 as $T);
|
||||||
|
Loading…
Reference in New Issue
Block a user