]> git.lizzy.rs Git - rust.git/blobdiff - src/test/bench/core-set.rs
test: Remove all uses of `~str` from the test suite.
[rust.git] / src / test / bench / core-set.rs
index 53b371e06cbe0d14f02dcebce2f1cceafff67ef0..757d61f28574692221efacea58c0ab390477901b 100644 (file)
@@ -80,7 +80,7 @@ pub fn bench_int<T:MutableSet<uint>,
         }
     }
 
-    pub fn bench_str<T:MutableSet<~str>,
+    pub fn bench_str<T:MutableSet<StrBuf>,
                      R:rand::Rng>(
                      &mut self,
                      rng: &mut R,
@@ -90,11 +90,11 @@ pub fn bench_str<T:MutableSet<~str>,
             let mut set = f();
             timed(&mut self.sequential_strings, || {
                 for i in range(0u, num_keys) {
-                    set.insert(i.to_str());
+                    set.insert(i.to_str().to_strbuf());
                 }
 
                 for i in range(0u, num_keys) {
-                    assert!(set.contains(&i.to_str()));
+                    assert!(set.contains(&i.to_str().to_strbuf()));
                 }
             })
         }
@@ -103,7 +103,7 @@ pub fn bench_str<T:MutableSet<~str>,
             let mut set = f();
             timed(&mut self.random_strings, || {
                 for _ in range(0, num_keys) {
-                    let s = rng.gen::<uint>().to_str();
+                    let s = rng.gen::<uint>().to_str().to_strbuf();
                     set.insert(s);
                 }
             })
@@ -112,11 +112,11 @@ pub fn bench_str<T:MutableSet<~str>,
         {
             let mut set = f();
             for i in range(0u, num_keys) {
-                set.insert(i.to_str());
+                set.insert(i.to_str().to_strbuf());
             }
             timed(&mut self.delete_strings, || {
                 for i in range(0u, num_keys) {
-                    assert!(set.remove(&i.to_str()));
+                    assert!(set.remove(&i.to_str().to_strbuf()));
                 }
             })
         }
@@ -175,7 +175,7 @@ fn main() {
             s
         });
         results.bench_str(&mut rng, num_keys, || {
-            let s: HashSet<~str> = HashSet::new();
+            let s: HashSet<StrBuf> = HashSet::new();
             s
         });
         write_results("collections::HashSet", &results);
@@ -189,7 +189,7 @@ fn main() {
             s
         });
         results.bench_str(&mut rng, num_keys, || {
-            let s: TreeSet<~str> = TreeSet::new();
+            let s: TreeSet<StrBuf> = TreeSet::new();
             s
         });
         write_results("collections::TreeSet", &results);