@@ -18,6 +18,7 @@ use crate::api::models::DeviceType;
1818fn device_type_from_u32_all_variants ( ) {
1919 assert_eq ! ( DeviceType :: from( 1 ) , DeviceType :: Ethernet ) ;
2020 assert_eq ! ( DeviceType :: from( 2 ) , DeviceType :: Wifi ) ;
21+ assert_eq ! ( DeviceType :: from( 11 ) , DeviceType :: Vlan ) ;
2122 assert_eq ! ( DeviceType :: from( 30 ) , DeviceType :: WifiP2P ) ;
2223 assert_eq ! ( DeviceType :: from( 32 ) , DeviceType :: Loopback ) ;
2324 assert_eq ! ( DeviceType :: from( 999 ) , DeviceType :: Other ( 999 ) ) ;
@@ -26,7 +27,9 @@ fn device_type_from_u32_all_variants() {
2627
2728#[ test]
2829fn device_type_from_u32_registry_types ( ) {
29- assert_eq ! ( DeviceType :: from( 11 ) , DeviceType :: Other ( 11 ) ) ;
30+ // VLAN is now a first-class variant
31+ assert_eq ! ( DeviceType :: from( 11 ) , DeviceType :: Vlan ) ;
32+ // These still fall through to Other since they're only in the registry
3033 assert_eq ! ( DeviceType :: from( 12 ) , DeviceType :: Other ( 12 ) ) ;
3134 assert_eq ! ( DeviceType :: from( 13 ) , DeviceType :: Other ( 13 ) ) ;
3235 assert_eq ! ( DeviceType :: from( 16 ) , DeviceType :: Other ( 16 ) ) ;
@@ -39,6 +42,7 @@ fn device_type_display() {
3942 assert_eq ! ( format!( "{}" , DeviceType :: Wifi ) , "Wi-Fi" ) ;
4043 assert_eq ! ( format!( "{}" , DeviceType :: WifiP2P ) , "Wi-Fi P2P" ) ;
4144 assert_eq ! ( format!( "{}" , DeviceType :: Loopback ) , "Loopback" ) ;
45+ assert_eq ! ( format!( "{}" , DeviceType :: Vlan ) , "VLAN" ) ;
4246 assert_eq ! ( format!( "{}" , DeviceType :: Other ( 42 ) ) , "Other(42)" ) ;
4347}
4448
@@ -100,6 +104,7 @@ fn device_type_connection_type_str() {
100104 assert_eq ! ( DeviceType :: Wifi . connection_type_str( ) , "802-11-wireless" ) ;
101105 assert_eq ! ( DeviceType :: WifiP2P . connection_type_str( ) , "wifi-p2p" ) ;
102106 assert_eq ! ( DeviceType :: Loopback . connection_type_str( ) , "loopback" ) ;
107+ assert_eq ! ( DeviceType :: Vlan . connection_type_str( ) , "vlan" ) ;
103108}
104109
105110#[ test]
@@ -114,6 +119,7 @@ fn device_type_connection_type_str_registry() {
114119fn device_type_to_code ( ) {
115120 assert_eq ! ( DeviceType :: Ethernet . to_code( ) , 1 ) ;
116121 assert_eq ! ( DeviceType :: Wifi . to_code( ) , 2 ) ;
122+ assert_eq ! ( DeviceType :: Vlan . to_code( ) , 11 ) ;
117123 assert_eq ! ( DeviceType :: WifiP2P . to_code( ) , 30 ) ;
118124 assert_eq ! ( DeviceType :: Loopback . to_code( ) , 32 ) ;
119125 assert_eq ! ( DeviceType :: Other ( 999 ) . to_code( ) , 999 ) ;
0 commit comments