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:
		
							parent
							
								
									7d35c24061
								
							
						
					
					
						commit
						d602e9250a
					
				@ -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}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user