Fixed tests and removed dns error

This commit is contained in:
CosminPerRam 2022-11-28 01:22:59 +02:00
parent a1d42af2df
commit 2e8aa50c3a
3 changed files with 4 additions and 8 deletions

View file

@ -2,7 +2,7 @@
Who knows what the future holds... Who knows what the future holds...
# 0.0.6 - ??/??/2022 # 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. [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. [ARK: Survival Evolved](https://store.steampowered.com/app/346110/ARK_Survival_Evolved/) support.
[Unturned](https://store.steampowered.com/app/304930/Unturned/) support. [Unturned](https://store.steampowered.com/app/304930/Unturned/) support.

View file

@ -26,8 +26,6 @@ pub enum GDError {
UnknownEnumCast, UnknownEnumCast,
/// The server queried is not from the queried game. /// The server queried is not from the queried game.
BadGame(String), BadGame(String),
/// Problems occurred while dns resolving.
DnsResolve(String),
/// Couldn't bind a socket. /// Couldn't bind a socket.
SocketBind(String), SocketBind(String),
/// Invalid input. /// Invalid input.
@ -53,7 +51,6 @@ impl fmt::Display for GDError {
GDError::Decompress(details) => write!(f, "Couldn't decompress data: {details}"), GDError::Decompress(details) => write!(f, "Couldn't decompress data: {details}"),
GDError::UnknownEnumCast => write!(f, "Unknown enum cast encountered."), GDError::UnknownEnumCast => write!(f, "Unknown enum cast encountered."),
GDError::BadGame(details) => write!(f, "Queried another game that the supposed one: {details}"), 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::SocketBind(details) => write!(f, "Socket bind: {details}"),
GDError::InvalidInput(details) => write!(f, "Invalid input: {details}"), GDError::InvalidInput(details) => write!(f, "Invalid input: {details}"),
GDError::SocketConnect(details) => write!(f, "Socket connect: {details}"), GDError::SocketConnect(details) => write!(f, "Socket connect: {details}"),

View file

@ -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> { pub fn address_and_port_as_string(address: &str, port: u16) -> String {
Ok(address.to_string() + ":" + &*port.to_string()) address.to_string() + ":" + &*port.to_string()
} }
pub fn u8_lower_upper(n: u8) -> (u8, u8) { pub fn u8_lower_upper(n: u8) -> (u8, u8) {
@ -121,8 +121,7 @@ mod tests {
#[test] #[test]
fn address_and_port_as_string_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_eq!(address_and_port_as_string("192.168.0.1", 27015), "192.168.0.1:27015");
assert!(address_and_port_as_string("not_existent_address", 9999).is_err());
} }
#[test] #[test]