Skip to content

Commit

Permalink
Rollup merge of rust-lang#59206 - sntdevco:master, r=dtolnay
Browse files Browse the repository at this point in the history
Improved test output
  • Loading branch information
kennytm committed Mar 16, 2019
2 parents 2e1104f + e9e5a75 commit 6d4b7fa
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/liballoc/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn test_le() {
assert!("" <= "");
assert!("" <= "foo");
assert!("foo" <= "foo");
assert!("foo" != "bar");
assert_ne!("foo", "bar");
}

#[test]
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/tests/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use std::mem::drop;
#[test]
fn smoketest_cell() {
let x = Cell::new(10);
assert!(x == Cell::new(10));
assert!(x.get() == 10);
assert_eq!(x, Cell::new(10));
assert_eq!(x.get(), 10);
x.set(20);
assert!(x == Cell::new(20));
assert!(x.get() == 20);
assert_eq!(x, Cell::new(20));
assert_eq!(x.get(), 20);

let y = Cell::new((30, 40));
assert!(y == Cell::new((30, 40)));
assert!(y.get() == (30, 40));
assert_eq!(y, Cell::new((30, 40)));
assert_eq!(y.get(), (30, 40));
}

#[test]
Expand Down
48 changes: 24 additions & 24 deletions src/libcore/tests/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod tests {
fn test_overflows() {
assert!(MAX > 0);
assert!(MIN <= 0);
assert!(MIN + MAX + 1 == 0);
assert_eq!(MIN + MAX + 1, 0);
}

#[test]
Expand All @@ -22,22 +22,22 @@ mod tests {

#[test]
fn test_rem_euclid() {
assert!((-1 as $T).rem_euclid(MIN) == MAX);
assert_eq!((-1 as $T).rem_euclid(MIN), MAX);
}

#[test]
pub fn test_abs() {
assert!((1 as $T).abs() == 1 as $T);
assert!((0 as $T).abs() == 0 as $T);
assert!((-1 as $T).abs() == 1 as $T);
assert_eq!((1 as $T).abs(), 1 as $T);
assert_eq!((0 as $T).abs(), 0 as $T);
assert_eq!((-1 as $T).abs(), 1 as $T);
}

#[test]
fn test_signum() {
assert!((1 as $T).signum() == 1 as $T);
assert!((0 as $T).signum() == 0 as $T);
assert!((-0 as $T).signum() == 0 as $T);
assert!((-1 as $T).signum() == -1 as $T);
assert_eq!((1 as $T).signum(), 1 as $T);
assert_eq!((0 as $T).signum(), 0 as $T);
assert_eq!((-0 as $T).signum(), 0 as $T);
assert_eq!((-1 as $T).signum(), -1 as $T);
}

#[test]
Expand All @@ -58,12 +58,12 @@ mod tests {

#[test]
fn test_bitwise_operators() {
assert!(0b1110 as $T == (0b1100 as $T).bitor(0b1010 as $T));
assert!(0b1000 as $T == (0b1100 as $T).bitand(0b1010 as $T));
assert!(0b0110 as $T == (0b1100 as $T).bitxor(0b1010 as $T));
assert!(0b1110 as $T == (0b0111 as $T).shl(1));
assert!(0b0111 as $T == (0b1110 as $T).shr(1));
assert!(-(0b11 as $T) - (1 as $T) == (0b11 as $T).not());
assert_eq!(0b1110 as $T, (0b1100 as $T).bitor(0b1010 as $T));
assert_eq!(0b1000 as $T, (0b1100 as $T).bitand(0b1010 as $T));
assert_eq!(0b0110 as $T, (0b1100 as $T).bitxor(0b1010 as $T));
assert_eq!(0b1110 as $T, (0b0111 as $T).shl(1));
assert_eq!(0b0111 as $T, (0b1110 as $T).shr(1));
assert_eq!(-(0b11 as $T) - (1 as $T), (0b11 as $T).not());
}

const A: $T = 0b0101100;
Expand All @@ -75,17 +75,17 @@ mod tests {

#[test]
fn test_count_ones() {
assert!(A.count_ones() == 3);
assert!(B.count_ones() == 2);
assert!(C.count_ones() == 5);
assert_eq!(A.count_ones(), 3);
assert_eq!(B.count_ones(), 2);
assert_eq!(C.count_ones(), 5);
}

#[test]
fn test_count_zeros() {
let bits = mem::size_of::<$T>() * 8;
assert!(A.count_zeros() == bits as u32 - 3);
assert!(B.count_zeros() == bits as u32 - 2);
assert!(C.count_zeros() == bits as u32 - 5);
assert_eq!(A.count_zeros(), bits as u32 - 3);
assert_eq!(B.count_zeros(), bits as u32 - 2);
assert_eq!(C.count_zeros(), bits as u32 - 5);
}

#[test]
Expand Down Expand Up @@ -148,9 +148,9 @@ mod tests {

#[test]
fn test_signed_checked_div() {
assert!((10 as $T).checked_div(2) == Some(5));
assert!((5 as $T).checked_div(0) == None);
assert!(isize::MIN.checked_div(-1) == None);
assert_eq!((10 as $T).checked_div(2), Some(5));
assert_eq!((5 as $T).checked_div(0), None);
assert_eq!(isize::MIN.checked_div(-1), None);
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/tests/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ fn test_range() {
let r = Range { start: 2, end: 10 };
let mut count = 0;
for (i, ri) in r.enumerate() {
assert!(ri == i + 2);
assert_eq!(ri, i + 2);
assert!(ri >= 2 && ri < 10);
count += 1;
}
assert!(count == 8);
assert_eq!(count, 8);
}

#[test]
fn test_range_from() {
let r = RangeFrom { start: 2 };
let mut count = 0;
for (i, ri) in r.take(10).enumerate() {
assert!(ri == i + 2);
assert_eq!(ri, i + 2);
assert!(ri >= 2 && ri < 12);
count += 1;
}
assert!(count == 10);
assert_eq!(count, 10);
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions src/test/run-pass/array-slice-vec/estr-slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn main() {

let z : &str = "thing";
assert_eq!(v, x);
assert!(x != z);
assert_ne!(x, z);

let a = "aaaa";
let b = "bbbb";
Expand All @@ -26,23 +26,23 @@ pub fn main() {

assert!(a < b);
assert!(a <= b);
assert!(a != b);
assert_ne!(a, b);
assert!(b >= a);
assert!(b > a);

println!("{}", b);

assert!(a < c);
assert!(a <= c);
assert!(a != c);
assert_ne!(a, c);
assert!(c >= a);
assert!(c > a);

println!("{}", c);

assert!(c < cc);
assert!(c <= cc);
assert!(c != cc);
assert_ne!(c, cc);
assert!(cc >= c);
assert!(cc > c);

Expand Down

0 comments on commit 6d4b7fa

Please sign in to comment.