2015-11-16 05:25:01 +00:00
|
|
|
#[macro_use]
|
|
|
|
mod common;
|
|
|
|
|
|
|
|
use common::util::*;
|
|
|
|
|
|
|
|
static UTIL_NAME: &'static str = "sort";
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
2016-03-25 23:05:41 +00:00
|
|
|
fn test_numeric_floats_and_ints() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("numeric_floats_and_ints", "-n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2016-03-25 23:05:41 +00:00
|
|
|
fn test_numeric_floats() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("numeric_floats", "-n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2016-03-25 23:05:41 +00:00
|
|
|
fn test_numeric_unfixed_floats() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("numeric_unfixed_floats", "-n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2016-03-25 23:05:41 +00:00
|
|
|
fn test_numeric_fixed_floats() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("numeric_fixed_floats", "-n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2016-03-25 23:05:41 +00:00
|
|
|
fn test_numeric_unsorted_ints() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("numeric_unsorted_ints", "-n");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2016-03-25 23:05:41 +00:00
|
|
|
fn test_human_block_sizes() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("human_block_sizes", "-h");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2016-03-25 23:05:41 +00:00
|
|
|
fn test_month_default() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("month_default", "-M");
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
|
|
|
|
2016-03-26 01:27:12 +00:00
|
|
|
#[test]
|
|
|
|
fn test_default_unsorted_ints() {
|
2016-03-26 01:29:11 +00:00
|
|
|
test_helper("default_unsorted_ints", "");
|
2016-03-26 01:27:12 +00:00
|
|
|
}
|
|
|
|
|
2016-03-26 01:29:11 +00:00
|
|
|
fn test_helper(file_name: &str, args: &str) {
|
2015-11-16 05:25:01 +00:00
|
|
|
let (at, mut ucmd) = testing(UTIL_NAME);
|
|
|
|
ucmd.arg(args);
|
|
|
|
let out = ucmd.arg(format!("{}{}", file_name, ".txt")).run().stdout;
|
|
|
|
|
2016-03-25 23:05:41 +00:00
|
|
|
let filename = format!("{}{}", file_name, ".expected");
|
2015-11-16 05:25:01 +00:00
|
|
|
assert_eq!(out, at.read(&filename));
|
|
|
|
}
|