xref: /webrtc/ice/src/state/state_test.rs (revision 5d8fe953)
1 use super::*;
2 use crate::error::Result;
3 
4 #[test]
test_connected_state_string() -> Result<()>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             connection_state.to_string(),
20             expected_string,
21             "testCase: {expected_string} vs {connection_state}",
22         )
23     }
24 
25     Ok(())
26 }
27 
28 #[test]
test_gathering_state_string() -> Result<()>29 fn test_gathering_state_string() -> Result<()> {
30     let tests = vec![
31         (GatheringState::Unspecified, "unspecified"),
32         (GatheringState::New, "new"),
33         (GatheringState::Gathering, "gathering"),
34         (GatheringState::Complete, "complete"),
35     ];
36 
37     for (gathering_state, expected_string) in tests {
38         assert_eq!(
39             gathering_state.to_string(),
40             expected_string,
41             "testCase: {expected_string} vs {gathering_state}",
42         )
43     }
44 
45     Ok(())
46 }
47