Skip to content

Commit eb00913

Browse files
committed
Remove ratchet().
1 parent 72ae518 commit eb00913

File tree

1 file changed

+0
-68
lines changed

1 file changed

+0
-68
lines changed

src/libtest/lib.rs

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,6 @@ impl Clone for MetricMap {
239239
}
240240
}
241241

242-
/// Analysis of a single change in metric
243-
#[derive(Copy, PartialEq, Show)]
244-
pub struct MetricChange;
245-
246-
pub type MetricDiff = BTreeMap<String,MetricChange>;
247-
248242
// The default console test runner. It accepts the command line
249243
// arguments and a vector of test_descs.
250244
pub fn test_main(args: &[String], tests: Vec<TestDescAndFn> ) {
@@ -1166,26 +1160,6 @@ impl MetricMap {
11661160
let MetricMap(ref mut map) = *self;
11671161
map.insert(name.to_string(), m);
11681162
}
1169-
1170-
/// Attempt to "ratchet" an external metric file. This involves loading
1171-
/// metrics from a metric file (if it exists), comparing against
1172-
/// the metrics in `self` using `compare_to_old`, and rewriting the
1173-
/// file to contain the metrics in `self` if none of the
1174-
/// `MetricChange`s are `Regression`. Returns the diff as well
1175-
/// as a boolean indicating whether the ratchet succeeded.
1176-
pub fn ratchet(&self, p: &Path) -> (MetricDiff, bool) {
1177-
let diff : MetricDiff = BTreeMap::new();
1178-
let ok = diff.iter().all(|(_, v)| {
1179-
match *v {
1180-
_ => true
1181-
}
1182-
});
1183-
1184-
if ok {
1185-
self.save(p).unwrap();
1186-
}
1187-
return (diff, ok)
1188-
}
11891163
}
11901164

11911165

@@ -1594,46 +1568,4 @@ mod tests {
15941568
m1.insert_metric("in-both-want-upwards-and-improved", 1000.0, -10.0);
15951569
m2.insert_metric("in-both-want-upwards-and-improved", 2000.0, -10.0);
15961570
}
1597-
1598-
#[test]
1599-
pub fn ratchet_test() {
1600-
1601-
let dpth = TempDir::new("test-ratchet").ok().expect("missing test for ratchet");
1602-
let pth = dpth.path().join("ratchet.json");
1603-
1604-
let mut m1 = MetricMap::new();
1605-
m1.insert_metric("runtime", 1000.0, 2.0);
1606-
m1.insert_metric("throughput", 50.0, 2.0);
1607-
1608-
let mut m2 = MetricMap::new();
1609-
m2.insert_metric("runtime", 1100.0, 2.0);
1610-
m2.insert_metric("throughput", 50.0, 2.0);
1611-
1612-
m1.save(&pth).unwrap();
1613-
1614-
// Ask for a ratchet that should fail to advance.
1615-
let (diff1, ok1) = m2.ratchet(&pth);
1616-
assert_eq!(ok1, false);
1617-
assert_eq!(diff1.len(), 2);
1618-
1619-
// Check that it was not rewritten.
1620-
let m3 = MetricMap::load(&pth);
1621-
let MetricMap(m3) = m3;
1622-
assert_eq!(m3.len(), 2);
1623-
assert_eq!(*(m3.get(&"runtime".to_string()).unwrap()), Metric::new(1000.0, 2.0));
1624-
assert_eq!(*(m3.get(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0));
1625-
1626-
// Ask for a ratchet with an explicit noise-percentage override,
1627-
// that should advance.
1628-
let (diff2, ok2) = m2.ratchet(&pth);
1629-
assert_eq!(ok2, true);
1630-
assert_eq!(diff2.len(), 2);
1631-
1632-
// Check that it was rewritten.
1633-
let m4 = MetricMap::load(&pth);
1634-
let MetricMap(m4) = m4;
1635-
assert_eq!(m4.len(), 2);
1636-
assert_eq!(*(m4.get(&"runtime".to_string()).unwrap()), Metric::new(1100.0, 2.0));
1637-
assert_eq!(*(m4.get(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0));
1638-
}
16391571
}

0 commit comments

Comments
 (0)