1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

tests: extern crates in separated test modules

This commit is contained in:
Knight 2016-08-06 11:18:34 +08:00
parent 2eeb7b77cc
commit cfc28ebc05
6 changed files with 17 additions and 23 deletions

0
tests/common/macros.rs Executable file → Normal file
View file

3
tests/common/util.rs Executable file → Normal file
View file

@ -1,4 +1,5 @@
#![allow(dead_code)]
extern crate tempdir;
use std::env;
use std::fs::{self, File, OpenOptions};
@ -14,7 +15,7 @@ use std::ffi::OsStr;
use std::rc::Rc;
use std::thread::sleep;
use std::time::Duration;
use tempdir::TempDir;
use self::tempdir::TempDir;
#[cfg(windows)]
static PROGNAME: &'static str = "uutils.exe";

View file

@ -8,9 +8,14 @@
//
use common::util::*;
use rand::{weak_rng, Rng};
use rand::distributions::{IndependentSample, Range};
use sieve::Sieve;
#[path="../src/factor/sieve.rs"]
mod sieve;
use self::sieve::Sieve;
extern crate rand;
use self::rand::{weak_rng, Rng};
use self::rand::distributions::{IndependentSample, Range};
const NUM_PRIMES: usize = 10000;
const LOG_PRIMES: f64 = 14.0; // ceil(log2(NUM_PRIMES))

View file

@ -1,5 +1,6 @@
use common::util::*;
use tempdir::TempDir;
extern crate tempdir;
use self::tempdir::TempDir;
static UTIL_NAME: &'static str = "mktemp";

View file

@ -4,8 +4,8 @@ extern crate regex;
use std::fs::{File, read_dir};
use std::io::{Read, Write};
use std::path::Path;
use rand::{Rng, thread_rng};
use regex::Regex;
use self::rand::{Rng, thread_rng};
use self::regex::Regex;
use common::util::*;
static UTIL_NAME: &'static str = "split";

View file

@ -1,19 +1,6 @@
extern crate filetime;
extern crate libc;
extern crate rand;
extern crate regex;
extern crate tempdir;
extern crate time;
#[cfg(windows)] extern crate kernel32;
#[cfg(windows)] extern crate winapi;
#[macro_use]
mod common;
#[path="../src/factor/sieve.rs"]
mod sieve;
// For conditional compilation
macro_rules! unix_only {
($($fea:expr, $m:ident);+) => {