diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-10-03 09:57:26 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-10-03 09:57:26 -0600 |
commit | d4e977a2be1f1fea81c32d1f7024b228cb161966 (patch) | |
tree | 95cb2d618f151e1e108838113ba71e93276b4850 /components/util/vec.rs | |
parent | a2531cd8aa0463e0941229b2f89f1433ad5b5e5e (diff) | |
parent | 7f6f072b02a50a609ff03c4b095476c83ff4d60e (diff) | |
download | servo-d4e977a2be1f1fea81c32d1f7024b228cb161966.tar.gz servo-d4e977a2be1f1fea81c32d1f7024b228cb161966.zip |
auto merge of #3566 : metajack/servo/fixup-unit-tests, r=mbrubeck
This adds the subpackages to `./mach test-unit`.
Diffstat (limited to 'components/util/vec.rs')
-rw-r--r-- | components/util/vec.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/util/vec.rs b/components/util/vec.rs index b8d24687d28..61fd05fe0c5 100644 --- a/components/util/vec.rs +++ b/components/util/vec.rs @@ -11,7 +11,7 @@ pub trait Comparator<K,T> { } pub trait BinarySearchMethods<'a, T: Ord + PartialOrd + PartialEq> { - fn binary_search(&self, key: &T) -> Option<&'a T>; + fn binary_search_(&self, key: &T) -> Option<&'a T>; fn binary_search_index(&self, key: &T) -> Option<uint>; } @@ -20,7 +20,7 @@ pub trait FullBinarySearchMethods<T> { } impl<'a, T: Ord + PartialOrd + PartialEq> BinarySearchMethods<'a, T> for &'a [T] { - fn binary_search(&self, key: &T) -> Option<&'a T> { + fn binary_search_(&self, key: &T) -> Option<&'a T> { self.binary_search_index(key).map(|i| &self[i]) } @@ -65,7 +65,7 @@ impl<T:PartialEq + PartialOrd + Ord> Comparator<T,T> for DefaultComparator { fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) { let mut i = 0; while i < arr.len() { - assert!(test_match(&arr[i], arr.binary_search(&arr[i]))); + assert!(test_match(&arr[i], arr.binary_search_(&arr[i]))); i += 1; } } @@ -74,9 +74,9 @@ fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) { fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T], misses: &[T]) { let mut i = 0; while i < misses.len() { - let res = arr.binary_search(&misses[i]); + let res = arr.binary_search_(&misses[i]); debug!("{:?} == {:?} ?", misses[i], res); - assert!(!test_match(&misses[i], arr.binary_search(&misses[i]))); + assert!(!test_match(&misses[i], arr.binary_search_(&misses[i]))); i += 1; } } |