Skip to content

Commit ba2ffcd

Browse files
authored
Merge pull request #135 from http-rs/version-ord-test
Add version ord tests
2 parents 6637afc + c63d217 commit ba2ffcd

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

src/version.rs

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
1-
/// The version of the HTTP protocol in use.
2-
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
3-
#[non_exhaustive]
4-
pub enum Version {
5-
/// HTTP/0.9
6-
Http0_9,
7-
8-
/// HTTP/1.0
9-
Http1_0,
10-
11-
/// HTTP/1.1
12-
Http1_1,
13-
14-
/// HTTP/2.0
15-
Http2_0,
16-
17-
/// HTTP/3.0
18-
Http3_0,
19-
}
1+
/// The version of the HTTP protocol in use.
2+
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
3+
#[non_exhaustive]
4+
pub enum Version {
5+
/// HTTP/0.9
6+
Http0_9,
7+
8+
/// HTTP/1.0
9+
Http1_0,
10+
11+
/// HTTP/1.1
12+
Http1_1,
13+
14+
/// HTTP/2.0
15+
Http2_0,
16+
17+
/// HTTP/3.0
18+
Http3_0,
19+
}
20+
21+
#[cfg(test)]
22+
mod test {
23+
use super::*;
24+
#[test]
25+
fn ord() {
26+
use Version::*;
27+
assert!(Http3_0 > Http2_0);
28+
assert!(Http2_0 > Http1_1);
29+
assert!(Http1_1 > Http1_0);
30+
assert!(Http1_0 > Http0_9);
31+
}
32+
}

0 commit comments

Comments
 (0)