Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e118eb6

Browse files
committedAug 1, 2019
librustc_data_structures: Unconfigure tests during normal build
1 parent ca0ef0f commit e118eb6

File tree

29 files changed

+1180
-1169
lines changed

29 files changed

+1180
-1169
lines changed
 

‎src/librustc_data_structures/base_n.rs

+3-21
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
44
use std::str;
55

6+
#[cfg(test)]
7+
mod tests;
8+
69
pub const MAX_BASE: usize = 64;
710
pub const ALPHANUMERIC_ONLY: usize = 62;
811
pub const CASE_INSENSITIVE: usize = 36;
@@ -38,24 +41,3 @@ pub fn encode(n: u128, base: usize) -> String {
3841
push_str(n, base, &mut s);
3942
s
4043
}
41-
42-
#[test]
43-
fn test_encode() {
44-
fn test(n: u128, base: usize) {
45-
assert_eq!(Ok(n), u128::from_str_radix(&encode(n, base), base as u32));
46-
}
47-
48-
for base in 2..37 {
49-
test(0, base);
50-
test(1, base);
51-
test(35, base);
52-
test(36, base);
53-
test(37, base);
54-
test(u64::max_value() as u128, base);
55-
test(u128::max_value(), base);
56-
57-
for i in 0 .. 1_000 {
58-
test(i * 983, base);
59-
}
60-
}
61-
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use super::*;
2+
3+
#[test]
4+
fn test_encode() {
5+
fn test(n: u128, base: usize) {
6+
assert_eq!(Ok(n), u128::from_str_radix(&encode(n, base), base as u32));
7+
}
8+
9+
for base in 2..37 {
10+
test(0, base);
11+
test(1, base);
12+
test(35, base);
13+
test(36, base);
14+
test(37, base);
15+
test(u64::max_value() as u128, base);
16+
test(u128::max_value(), base);
17+
18+
for i in 0 .. 1_000 {
19+
test(i * 983, base);
20+
}
21+
}
22+
}

‎src/librustc_data_structures/binary_search_util/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[cfg(test)]
2-
mod test;
2+
mod tests;
33

44
/// Uses a sorted slice `data: &[E]` as a kind of "multi-map". The
55
/// `key_fn` extracts a key of type `K` from the data, and this

0 commit comments

Comments
 (0)
Please sign in to comment.