mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Merge pull request #856 from jbcrail/refactor-sort-tests
Refactor sort tests
This commit is contained in:
commit
9e5a2400be
19 changed files with 218 additions and 26 deletions
100
tests/fixtures/sort/default_unsorted_ints.expected
vendored
Normal file
100
tests/fixtures/sort/default_unsorted_ints.expected
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
1
|
||||
10
|
||||
100
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
2
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
3
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
4
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
5
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
6
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
7
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
75
|
||||
76
|
||||
77
|
||||
78
|
||||
79
|
||||
8
|
||||
80
|
||||
81
|
||||
82
|
||||
83
|
||||
84
|
||||
85
|
||||
86
|
||||
87
|
||||
88
|
||||
89
|
||||
9
|
||||
90
|
||||
91
|
||||
92
|
||||
93
|
||||
94
|
||||
95
|
||||
96
|
||||
97
|
||||
98
|
||||
99
|
2
tests/fixtures/sort/numeric5.ans
vendored
2
tests/fixtures/sort/numeric5.ans
vendored
|
@ -1,2 +0,0 @@
|
|||
.022
|
||||
.024
|
2
tests/fixtures/sort/numeric5.txt
vendored
2
tests/fixtures/sort/numeric5.txt
vendored
|
@ -1,2 +0,0 @@
|
|||
.022
|
||||
.024
|
100
tests/fixtures/sort/numeric_unsorted_ints.txt
vendored
Normal file
100
tests/fixtures/sort/numeric_unsorted_ints.txt
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
33
|
||||
16
|
||||
35
|
||||
56
|
||||
72
|
||||
37
|
||||
21
|
||||
49
|
||||
70
|
||||
48
|
||||
90
|
||||
83
|
||||
44
|
||||
79
|
||||
10
|
||||
20
|
||||
4
|
||||
26
|
||||
27
|
||||
63
|
||||
29
|
||||
47
|
||||
51
|
||||
85
|
||||
88
|
||||
46
|
||||
30
|
||||
61
|
||||
93
|
||||
81
|
||||
78
|
||||
53
|
||||
87
|
||||
18
|
||||
98
|
||||
38
|
||||
13
|
||||
39
|
||||
23
|
||||
71
|
||||
5
|
||||
100
|
||||
96
|
||||
8
|
||||
24
|
||||
14
|
||||
28
|
||||
15
|
||||
25
|
||||
43
|
||||
36
|
||||
67
|
||||
75
|
||||
66
|
||||
31
|
||||
57
|
||||
34
|
||||
80
|
||||
40
|
||||
86
|
||||
17
|
||||
55
|
||||
9
|
||||
1
|
||||
62
|
||||
12
|
||||
74
|
||||
58
|
||||
69
|
||||
76
|
||||
11
|
||||
73
|
||||
68
|
||||
59
|
||||
41
|
||||
45
|
||||
52
|
||||
97
|
||||
82
|
||||
6
|
||||
7
|
||||
77
|
||||
42
|
||||
84
|
||||
95
|
||||
94
|
||||
89
|
||||
19
|
||||
64
|
||||
2
|
||||
22
|
||||
50
|
||||
60
|
||||
32
|
||||
92
|
||||
3
|
||||
99
|
||||
65
|
||||
54
|
||||
91
|
|
@ -7,54 +7,50 @@ static UTIL_NAME: &'static str = "sort";
|
|||
|
||||
|
||||
#[test]
|
||||
fn numeric1() {
|
||||
numeric_helper(1);
|
||||
fn test_numeric_floats_and_ints() {
|
||||
test_helper("numeric_floats_and_ints", "-n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn numeric2() {
|
||||
numeric_helper(2);
|
||||
fn test_numeric_floats() {
|
||||
test_helper("numeric_floats", "-n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn numeric3() {
|
||||
numeric_helper(3);
|
||||
fn test_numeric_unfixed_floats() {
|
||||
test_helper("numeric_unfixed_floats", "-n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn numeric4() {
|
||||
numeric_helper(4);
|
||||
fn test_numeric_fixed_floats() {
|
||||
test_helper("numeric_fixed_floats", "-n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn numeric5() {
|
||||
numeric_helper(5);
|
||||
fn test_numeric_unsorted_ints() {
|
||||
test_helper("numeric_unsorted_ints", "-n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn numeric6() {
|
||||
numeric_helper(6);
|
||||
fn test_human_block_sizes() {
|
||||
test_helper("human_block_sizes", "-h");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn human1() {
|
||||
test_helper(&String::from("human1"), &String::from("-h"));
|
||||
fn test_month_default() {
|
||||
test_helper("month_default", "-M");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn month1() {
|
||||
test_helper(&String::from("month1"), &String::from("-M"));
|
||||
fn test_default_unsorted_ints() {
|
||||
test_helper("default_unsorted_ints", "");
|
||||
}
|
||||
|
||||
fn numeric_helper(test_num: isize) {
|
||||
test_helper(&format!("numeric{}", test_num), &String::from("-n"))
|
||||
}
|
||||
|
||||
fn test_helper(file_name: &String, args: &String) {
|
||||
fn test_helper(file_name: &str, args: &str) {
|
||||
let (at, mut ucmd) = testing(UTIL_NAME);
|
||||
ucmd.arg(args);
|
||||
let out = ucmd.arg(format!("{}{}", file_name, ".txt")).run().stdout;
|
||||
|
||||
let filename = format!("{}{}", file_name, ".ans");
|
||||
let filename = format!("{}{}", file_name, ".expected");
|
||||
assert_eq!(out, at.read(&filename));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue