Debian Codegraph @

third_party/rust/webrtc-sdp/src/network_tests.rs

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 use super::*;
6
7 #[test]
8 fn test_parse_network_type() -> Result<(), SdpParserInternalError> {
9 parse_network_type("iN")?;
10
11 assert!(parse_network_type("").is_err());
12 assert!(parse_network_type("FOO").is_err());
13 Ok(())
14 }
15
16 #[test]
17 fn test_parse_address_type() -> Result<(), SdpParserInternalError> {
18 let ip4 = parse_address_type("iP4")?;
19 assert_eq!(ip4, AddressType::IpV4);
20 let ip6 = parse_address_type("Ip6")?;
21 assert_eq!(ip6, AddressType::IpV6);
22
23 assert!(parse_address_type("").is_err());
24 assert!(parse_address_type("IP5").is_err());
25 Ok(())
26 }
27
28 #[test]
29 fn test_parse_unicast_address() -> Result<(), SdpParserInternalError> {
30 parse_unicast_address("127.0.0.1")?;
31 parse_unicast_address("::1")?;
32 Ok(())
33 }