1 use super::*; 2 use crate::error::Result; 3 4 #[test] 5 fn test_connected_state_string() -> Result<()> { 6 let tests = vec![ 7 (ConnectionState::Unspecified, "Unspecified"), 8 (ConnectionState::New, "New"), 9 (ConnectionState::Checking, "Checking"), 10 (ConnectionState::Connected, "Connected"), 11 (ConnectionState::Completed, "Completed"), 12 (ConnectionState::Failed, "Failed"), 13 (ConnectionState::Disconnected, "Disconnected"), 14 (ConnectionState::Closed, "Closed"), 15 ]; 16 17 for (connection_state, expected_string) in tests { 18 assert_eq!( 19 expected_string, 20 connection_state.to_string(), 21 "testCase: {} vs {}", 22 expected_string, 23 connection_state, 24 ) 25 } 26 27 Ok(()) 28 } 29 30 #[test] 31 fn test_gathering_state_string() -> Result<()> { 32 let tests = vec![ 33 (GatheringState::Unspecified, "unspecified"), 34 (GatheringState::New, "new"), 35 (GatheringState::Gathering, "gathering"), 36 (GatheringState::Complete, "complete"), 37 ]; 38 39 for (gathering_state, expected_string) in tests { 40 assert_eq!( 41 expected_string, 42 gathering_state.to_string(), 43 "testCase: {} vs {}", 44 expected_string, 45 gathering_state, 46 ) 47 } 48 49 Ok(()) 50 } 51