github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/client/fingerprint/network_windows_test.go (about) 1 package fingerprint 2 3 import "testing" 4 5 func TestNetworkFingerPrint_linkspeed_parse(t *testing.T) { 6 f := &NetworkFingerprint{logger: testLogger(), interfaceDetector: &DefaultNetworkInterfaceDetector{}} 7 8 var outputTests = []struct { 9 in string 10 out int 11 }{ 12 {"10 Mbps", 10}, 13 {"2 bps", 0}, 14 {"1 Gbps", 1000}, 15 {"2Mbps", 0}, 16 {"1000 Kbps", 1}, 17 {"1 Kbps", 0}, 18 {"0 Mbps", 0}, 19 {"2 2 Mbps", 0}, 20 {"a Mbps", 0}, 21 {"1 Tbps", 0}, 22 } 23 24 for _, ot := range outputTests { 25 out := f.parseLinkSpeed(ot.in) 26 if out != ot.out { 27 t.Errorf("parseLinkSpeed(%s) => %d, should be %d", ot.in, out, ot.out) 28 } 29 } 30 }