1
0
mirror of https://github.com/taigrr/go-fastping synced 2025-01-18 05:03:15 -08:00

Add Err function's test

This commit is contained in:
Tatsushi Demachi 2015-08-18 21:57:50 +09:00
parent 7d35c24061
commit d602e9250a

View File

@ -341,6 +341,18 @@ func TestRunLoop(t *testing.T) {
} }
} }
func TestErr(t *testing.T) {
invalidSource := "192.0.2"
p := NewPinger()
p.ctx = newContext()
_ = p.listen("ip4:icmp", invalidSource)
if p.Err() == nil {
t.Errorf("Err should return an error but nothing")
}
}
func TestTimeToBytes(t *testing.T) { func TestTimeToBytes(t *testing.T) {
// 2009-11-10 23:00:00 +0000 UTC = 1257894000000000000 // 2009-11-10 23:00:00 +0000 UTC = 1257894000000000000
expect := []byte{0x11, 0x74, 0xef, 0xed, 0xab, 0x18, 0x60, 0x00} expect := []byte{0x11, 0x74, 0xef, 0xed, 0xab, 0x18, 0x60, 0x00}