summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValerii Hiora <valerii.hiora@gmail.com>2015-01-02 13:23:36 +0200
committerValerii Hiora <valerii.hiora@gmail.com>2015-01-02 13:23:36 +0200
commitc82c8cced23256ebeeea978fda67abd976280425 (patch)
tree3e3af67b97ca1240522903f2e153361e5e5919d8 /tests
parent5bb9518aa029fc24da3fa71103d320919f2dd60c (diff)
downloadnix-c82c8cced23256ebeeea978fda67abd976280425.zip
Track rust master
- Updated array syntax - task_rng -> thread_rng
Diffstat (limited to 'tests')
-rw-r--r--tests/unistd.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/unistd.rs b/tests/unistd.rs
index 717e109f..075181bc 100644
--- a/tests/unistd.rs
+++ b/tests/unistd.rs
@@ -1,17 +1,16 @@
-
extern crate nix;
#[cfg(test)]
mod test {
use nix::unistd::{writev, readv, Iovec, pipe, close, read, write};
- use std::rand::{task_rng, Rng};
+ use std::rand::{thread_rng, Rng};
use std::cmp::min;
#[test]
fn test_writev() {
let mut to_write = Vec::with_capacity(16 * 128);
for _ in range(0u, 16) {
- let s:String = task_rng().gen_ascii_chars().take(128).collect();
+ let s:String = thread_rng().gen_ascii_chars().take(128).collect();
let b = s.as_bytes();
to_write.extend(b.iter().map(|x| x.clone()));
}
@@ -20,7 +19,7 @@ mod test {
let mut consumed = 0;
while consumed < to_write.len() {
let left = to_write.len() - consumed;
- let slice_len = if left < 64 { left } else { task_rng().gen_range(64, min(256, left)) };
+ let slice_len = if left < 64 { left } else { thread_rng().gen_range(64, min(256, left)) };
let b = to_write.slice(consumed, consumed + slice_len);
iovecs.push(Iovec::from_slice(b));
consumed += slice_len;
@@ -53,13 +52,13 @@ mod test {
#[test]
fn test_readv() {
- let s:String = task_rng().gen_ascii_chars().take(128).collect();
+ let s:String = thread_rng().gen_ascii_chars().take(128).collect();
let to_write = s.as_bytes().to_vec();
let mut storage = Vec::new();
let mut allocated = 0;
while allocated < to_write.len() {
let left = to_write.len() - allocated;
- let vec_len = if left < 64 { left } else { task_rng().gen_range(64, min(256, left)) };
+ let vec_len = if left < 64 { left } else { thread_rng().gen_range(64, min(256, left)) };
let v = Vec::from_elem(vec_len, 0u8);
storage.push(v);
allocated += vec_len;