Add an auto-measure toggle with a cable length range, and console keys through the harness
This commit is contained in:
+35
-5
@@ -14,7 +14,7 @@ func TestPhyDisplayWorstMarginAndFault(t *testing.T) {
|
||||
}
|
||||
a := freshMod([4]float64{5, 5, 2, 0.5})
|
||||
b := freshMod([4]float64{4, 5, 5, 5})
|
||||
d := phyDisplayFrom(cable, false, a, b)
|
||||
d := phyDisplayFrom(cable, cableRange{}, false, a, b)
|
||||
|
||||
if !d.haveSNR || d.worstMargin != 0.5 {
|
||||
t.Errorf("worstMargin = %v (have %v), want 0.5", d.worstMargin, d.haveSNR)
|
||||
@@ -27,15 +27,15 @@ func TestPhyDisplayWorstMarginAndFault(t *testing.T) {
|
||||
func TestPhyDisplaySNREndOwnsMargin(t *testing.T) {
|
||||
wiitek := freshMod([4]float64{9.2, 7.2, 7.0, 8.7})
|
||||
fs := phyModView{fresh: true, link: true}
|
||||
d := phyDisplayFrom(cableInfo{}, false, wiitek, fs)
|
||||
d := phyDisplayFrom(cableInfo{}, cableRange{}, false, wiitek, fs)
|
||||
if !d.haveSNR || d.worstMargin != 7.0 {
|
||||
t.Errorf("worstMargin = %v (have %v), want the SNR end's 7.0", d.worstMargin, d.haveSNR)
|
||||
}
|
||||
d = phyDisplayFrom(cableInfo{}, false, fs, wiitek)
|
||||
d = phyDisplayFrom(cableInfo{}, cableRange{}, false, fs, wiitek)
|
||||
if !d.haveSNR || d.worstMargin != 7.0 {
|
||||
t.Errorf("swapped ends: worstMargin = %v, want 7.0", d.worstMargin)
|
||||
}
|
||||
d = phyDisplayFrom(cableInfo{}, false, fs, fs)
|
||||
d = phyDisplayFrom(cableInfo{}, cableRange{}, false, fs, fs)
|
||||
if d.haveSNR {
|
||||
t.Error("a pair with no SNR end should withhold snr")
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func TestPhyDisplayStaleGoesDim(t *testing.T) {
|
||||
maps: [2]byte{pairIdentityMap, pairIdentityMap},
|
||||
haveMaps: [2]bool{true, true},
|
||||
}
|
||||
d := phyDisplayFrom(cable, false, freshMod([4]float64{5, 5, 5, 5}), phyModView{})
|
||||
d := phyDisplayFrom(cable, cableRange{}, false, freshMod([4]float64{5, 5, 5, 5}), phyModView{})
|
||||
if d.haveSNR {
|
||||
t.Error("one silent module should withhold snr")
|
||||
}
|
||||
@@ -93,6 +93,36 @@ func TestCableMetresString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCableRange(t *testing.T) {
|
||||
var r cableRange
|
||||
for _, m := range []int{42, 40, 44, 41} {
|
||||
r.add(m)
|
||||
}
|
||||
if r.String() != "40-44" {
|
||||
t.Errorf("range = %q, want 40-44", r.String())
|
||||
}
|
||||
one := cableRange{}
|
||||
one.add(42)
|
||||
if one.String() != "42" {
|
||||
t.Errorf("single measure = %q, want 42", one.String())
|
||||
}
|
||||
|
||||
cable := cableInfo{
|
||||
ecd: ecdResult{verdicts: [4]int{pairOK, pairOK, pairOK, pairOK}, metres: [4]int{45, 45, 41, 46}},
|
||||
maps: [2]byte{pairIdentityMap, pairIdentityMap},
|
||||
haveMaps: [2]bool{true, true},
|
||||
}
|
||||
d := phyDisplayFrom(cable, r, false, freshMod([4]float64{5, 5, 5, 5}), freshMod([4]float64{5, 5, 5, 5}))
|
||||
if d.metres != "40-44" || d.metresClass != clsGood {
|
||||
t.Errorf("metres = %q class %d, want the range shown good", d.metres, d.metresClass)
|
||||
}
|
||||
faulted := cableInfo{ecd: ecdResult{verdicts: [4]int{pairOK, pairOpen, pairOK, pairOK}}}
|
||||
d = phyDisplayFrom(faulted, r, false, freshMod([4]float64{5, 5, 5, 5}), freshMod([4]float64{5, 5, 5, 5}))
|
||||
if d.metres != "OPEN" {
|
||||
t.Errorf("fault shows %q, want the verdict to beat the range", d.metres)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSNRClass(t *testing.T) {
|
||||
for _, c := range []struct {
|
||||
margin float64
|
||||
|
||||
Reference in New Issue
Block a user