@@ -9,6 +9,27 @@ use core::fmt;
9
9
#[ derive( Copy , Clone , Eq , PartialEq , Ord , PartialOrd ) ]
10
10
pub struct Revision ( u32 ) ;
11
11
12
+ // Allow missing docs, there's nothing useful to document about these
13
+ // constants.
14
+ #[ allow( missing_docs) ]
15
+ // Allow consistent formatting of the values.
16
+ #[ allow( clippy:: identity_op) ]
17
+ impl Revision {
18
+ pub const EFI_1_02 : Self = Self ( ( 1 << 16 ) | ( 2 ) ) ;
19
+ pub const EFI_1_10 : Self = Self ( ( 1 << 16 ) | ( 10 ) ) ;
20
+ pub const EFI_2_00 : Self = Self ( ( 2 << 16 ) | ( 00 ) ) ;
21
+ pub const EFI_2_10 : Self = Self ( ( 2 << 16 ) | ( 10 ) ) ;
22
+ pub const EFI_2_20 : Self = Self ( ( 2 << 16 ) | ( 20 ) ) ;
23
+ pub const EFI_2_30 : Self = Self ( ( 2 << 16 ) | ( 30 ) ) ;
24
+ pub const EFI_2_31 : Self = Self ( ( 2 << 16 ) | ( 31 ) ) ;
25
+ pub const EFI_2_40 : Self = Self ( ( 2 << 16 ) | ( 40 ) ) ;
26
+ pub const EFI_2_50 : Self = Self ( ( 2 << 16 ) | ( 50 ) ) ;
27
+ pub const EFI_2_60 : Self = Self ( ( 2 << 16 ) | ( 60 ) ) ;
28
+ pub const EFI_2_70 : Self = Self ( ( 2 << 16 ) | ( 70 ) ) ;
29
+ pub const EFI_2_80 : Self = Self ( ( 2 << 16 ) | ( 80 ) ) ;
30
+ pub const EFI_2_90 : Self = Self ( ( 2 << 16 ) | ( 90 ) ) ;
31
+ }
32
+
12
33
impl Revision {
13
34
/// Creates a new revision.
14
35
pub fn new ( major : u16 , minor : u16 ) -> Self {
@@ -35,3 +56,17 @@ impl fmt::Debug for Revision {
35
56
write ! ( f, "{}.{}.{}" , major, minor / 10 , minor % 10 )
36
57
}
37
58
}
59
+
60
+ #[ cfg( test) ]
61
+ mod tests {
62
+ use super :: * ;
63
+
64
+ #[ test]
65
+ fn test_revision ( ) {
66
+ let rev = Revision :: EFI_2_31 ;
67
+ assert_eq ! ( rev. major( ) , 2 ) ;
68
+ assert_eq ! ( rev. minor( ) , 31 ) ;
69
+
70
+ assert ! ( Revision :: EFI_1_10 < Revision :: EFI_2_00 ) ;
71
+ }
72
+ }
0 commit comments