mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
Fixed tests and removed dns error
This commit is contained in:
parent
a1d42af2df
commit
2e8aa50c3a
3 changed files with 4 additions and 8 deletions
|
|
@ -2,7 +2,7 @@
|
|||
Who knows what the future holds...
|
||||
|
||||
# 0.0.6 - ??/??/2022
|
||||
[Minecraft](https://www.minecraft.com) implementation (bedrock not supported yet).
|
||||
[Minecraft](https://www.minecraft.com) support (bedrock not supported yet).
|
||||
[7 Days To Die](https://store.steampowered.com/app/251570/7_Days_to_Die/) support.
|
||||
[ARK: Survival Evolved](https://store.steampowered.com/app/346110/ARK_Survival_Evolved/) support.
|
||||
[Unturned](https://store.steampowered.com/app/304930/Unturned/) support.
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ pub enum GDError {
|
|||
UnknownEnumCast,
|
||||
/// The server queried is not from the queried game.
|
||||
BadGame(String),
|
||||
/// Problems occurred while dns resolving.
|
||||
DnsResolve(String),
|
||||
/// Couldn't bind a socket.
|
||||
SocketBind(String),
|
||||
/// Invalid input.
|
||||
|
|
@ -53,7 +51,6 @@ impl fmt::Display for GDError {
|
|||
GDError::Decompress(details) => write!(f, "Couldn't decompress data: {details}"),
|
||||
GDError::UnknownEnumCast => write!(f, "Unknown enum cast encountered."),
|
||||
GDError::BadGame(details) => write!(f, "Queried another game that the supposed one: {details}"),
|
||||
GDError::DnsResolve(details) => write!(f, "DNS Resolve: {details}"),
|
||||
GDError::SocketBind(details) => write!(f, "Socket bind: {details}"),
|
||||
GDError::InvalidInput(details) => write!(f, "Invalid input: {details}"),
|
||||
GDError::SocketConnect(details) => write!(f, "Socket connect: {details}"),
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ pub fn error_by_expected_size(expected: usize, size: usize) -> GDResult<()> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn address_and_port_as_string(address: &str, port: u16) -> GDResult<String> {
|
||||
Ok(address.to_string() + ":" + &*port.to_string())
|
||||
pub fn address_and_port_as_string(address: &str, port: u16) -> String {
|
||||
address.to_string() + ":" + &*port.to_string()
|
||||
}
|
||||
|
||||
pub fn u8_lower_upper(n: u8) -> (u8, u8) {
|
||||
|
|
@ -121,8 +121,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn address_and_port_as_string_test() {
|
||||
assert_eq!(address_and_port_as_string("192.168.0.1", 27015).unwrap(), "192.168.0.1:27015");
|
||||
assert!(address_and_port_as_string("not_existent_address", 9999).is_err());
|
||||
assert_eq!(address_and_port_as_string("192.168.0.1", 27015), "192.168.0.1:27015");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue