Skip to content

Commit

Permalink
✅ Add test for ICMPClient
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Oct 30, 2023
1 parent 8b66fe7 commit a7228e8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/Kernels/NetworkTest/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ protected override void Run()
TestDhcpConnection();
TestTcpConnection();
TestDnsConnection();
TestIcmpConnection();

TestController.Completed();
}
Expand Down Expand Up @@ -215,5 +216,22 @@ private void TestDnsConnection()
Global.debugger.Send("IP: " + ip);
}
}

private void TestIcmpConnection()
{
Global.debugger.Send("Creating ICMP client...");

using (var xClient = new ICMPClient())
{
xClient.Connect(new Address(127, 0, 0, 1)); //Cloudflare DNS

xClient.SendEcho();

var endpoint = new EndPoint(Address.Zero, 0);
int time = xClient.Receive(ref endpoint);

Assert.IsFalse(time == -1, "ICMP echo works");
}
}
}
}

0 comments on commit a7228e8

Please sign in to comment.