upd8
This commit is contained in:
@@ -1,20 +1,29 @@
|
|||||||
import netio
|
import netio
|
||||||
|
|
||||||
fn test_name_to_index() {
|
|
||||||
assert netio.name_to_index('lo')! == 1
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test_index_to_name() {
|
|
||||||
assert netio.index_to_name(1)! == 'lo'
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test_network_interfaces() {
|
fn test_network_interfaces() {
|
||||||
ifs := netio.network_interfaces()!
|
ifs := netio.network_interfaces()!
|
||||||
// dump(ifs)
|
// dump(ifs)
|
||||||
assert ifs.len > 0
|
assert ifs.len > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_find_network_interface() {
|
fn test_name_to_index() {
|
||||||
assert netio.find_network_interface('lo')!.name == 'lo'
|
ifs := netio.network_interfaces()!
|
||||||
assert netio.find_network_interface('1')!.index == 1
|
iface := ifs[0]
|
||||||
|
dump(iface)
|
||||||
|
assert netio.name_to_index(iface.name)! == iface.index
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_index_to_name() {
|
||||||
|
ifs := netio.network_interfaces()!
|
||||||
|
iface := ifs[0]
|
||||||
|
dump(iface)
|
||||||
|
assert netio.index_to_name(iface.index)! == iface.name
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_find_network_interface() {
|
||||||
|
ifs := netio.network_interfaces()!
|
||||||
|
iface := ifs[0]
|
||||||
|
dump(iface)
|
||||||
|
assert netio.find_network_interface(iface.name)!.name == iface.name
|
||||||
|
assert netio.find_network_interface(iface.index.str())!.index == iface.index
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user