Add the ability to ignore tests, so that day-to-day testing only takes a little while.

This commit is contained in:
2018-10-08 20:34:36 -07:00
parent a251b7a294
commit d43f0bcd42
14 changed files with 618 additions and 446 deletions

View File

@@ -46,27 +46,37 @@ macro_rules! generate_cmp_tests {
($name: ident, $lname: ident) => {
#[test]
fn $lname() {
let fname = format!("testdata/cmp/{}.tests", stringify!($name));
run_test(fname.to_string(), 5, |case| {
let (neg0, abytes) = case.get("a").unwrap();
let (neg1, bbytes) = case.get("b").unwrap();
let (neg2, ebytes) = case.get("e").unwrap();
let (neg3, gbytes) = case.get("g").unwrap();
let (neg4, lbytes) = case.get("l").unwrap();
assert!(!neg0 && !neg1 && !neg2 && !neg3 && !neg4);
let a = $name::from_bytes(abytes);
let b = $name::from_bytes(bbytes);
let e = 1 == ebytes[0];
let g = 1 == gbytes[0];
let l = 1 == lbytes[0];
assert_eq!(e, a == b);
assert_eq!(g, a > b);
assert_eq!(l, a < b);
assert_eq!(e || g, a >= b);
assert_eq!(e || l, a <= b);
});
generate_cmp_tests!(body $name, $lname);
}
};
(ignore $name: ident, $lname: ident) => {
#[test]
#[ignore]
fn $lname() {
generate_cmp_tests!(body $name, $lname);
}
};
(body $name: ident, $lname: ident) => {
let fname = format!("testdata/cmp/{}.tests", stringify!($name));
run_test(fname.to_string(), 5, |case| {
let (neg0, abytes) = case.get("a").unwrap();
let (neg1, bbytes) = case.get("b").unwrap();
let (neg2, ebytes) = case.get("e").unwrap();
let (neg3, gbytes) = case.get("g").unwrap();
let (neg4, lbytes) = case.get("l").unwrap();
assert!(!neg0 && !neg1 && !neg2 && !neg3 && !neg4);
let a = $name::from_bytes(abytes);
let b = $name::from_bytes(bbytes);
let e = 1 == ebytes[0];
let g = 1 == gbytes[0];
let l = 1 == lbytes[0];
assert_eq!(e, a == b);
assert_eq!(g, a > b);
assert_eq!(l, a < b);
assert_eq!(e || g, a >= b);
assert_eq!(e || l, a <= b);
});
};
}