all: clean up lint identified by ruleguard

Ruleguard run with ruleguard -c=0 -rules ruleguard.rules.go ./... from
https://github.com/dgryski/semgrep-go with the following rules inactivated
to reduce noise:

- unconvert for floating point values
- oddcomparisons
- floateq
This commit is contained in:
Dan Kortschak
2021-05-18 20:22:10 +09:30
parent a4975614d9
commit 03398562de
40 changed files with 82 additions and 82 deletions

View File

@@ -388,7 +388,7 @@ func undirectedSubGraphFrom(g []intset, s map[int64][]intset) graph.Graph {
sub.SetEdge(ce)
}
}
subs[i] = subGraph{id: int64(i), Graph: sub}
subs[i] = subGraph{id: i, Graph: sub}
base += int64(len(sg))
}

View File

@@ -175,7 +175,7 @@ type node struct {
}
func (n *node) ID() int64 { return int64(n.id) }
func (n *node) DOTID() string { return fmt.Sprintf("0x%016x", uint64(n.id)) }
func (n *node) DOTID() string { return fmt.Sprintf("0x%016x", n.id) }
func (n *node) SetIDFromString(uid string) error {
if !strings.HasPrefix(uid, "0x") {

View File

@@ -356,7 +356,7 @@ func TestDistanceCentralityDirected(t *testing.T) {
if !scalar.EqualWithinAbsOrRel(got[int64(n)], 1/test.farness[int64(n)], tol, tol) {
want := make(map[int64]float64)
for n, v := range test.farness {
want[int64(n)] = 1 / v
want[n] = 1 / v
}
t.Errorf("unexpected closeness centrality for test %d:\ngot: %v\nwant:%v",
i, orderedFloats(got, prec), orderedFloats(want, prec))

View File

@@ -75,7 +75,7 @@ func TestPathExistsInUndirected(t *testing.T) {
g.AddNode(simple.Node(u))
}
for v := range e {
if g.Node(int64(v)) == nil {
if g.Node(v) == nil {
g.AddNode(simple.Node(v))
}
g.SetEdge(simple.Edge{F: simple.Node(u), T: simple.Node(v)})
@@ -114,7 +114,7 @@ func TestPathExistsInDirected(t *testing.T) {
g.AddNode(simple.Node(u))
}
for v := range e {
if g.Node(int64(v)) == nil {
if g.Node(v) == nil {
g.AddNode(simple.Node(v))
}
g.SetEdge(simple.Edge{F: simple.Node(u), T: simple.Node(v)})
@@ -151,7 +151,7 @@ func TestConnectedComponents(t *testing.T) {
g.AddNode(simple.Node(u))
}
for v := range e {
if g.Node(int64(v)) == nil {
if g.Node(v) == nil {
g.AddNode(simple.Node(v))
}
g.SetEdge(simple.Edge{F: simple.Node(u), T: simple.Node(v)})

View File

@@ -250,8 +250,8 @@ func TestAxpyInc(t *testing.T) {
x, y := test.x[xgLn:len(test.x)-xgLn], test.y[ygLn:len(test.y)-ygLn]
AxpyInc(test.a, x, y, uintptr(len(test.ex)), uintptr(test.incX), uintptr(test.incY), test.ix, test.iy)
for i := range test.ex {
if y[int(test.iy)+i*int(test.incY)] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, y[i*int(test.incY)], test.ex[i])
if y[int(test.iy)+i*test.incY] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, y[i*test.incY], test.ex[i])
}
}
checkValidIncGuard(t, test.x, xGdVal, test.incX, xgLn)
@@ -269,8 +269,8 @@ func TestAxpyIncTo(t *testing.T) {
dst := test.dst[xgLn : len(test.dst)-xgLn]
AxpyIncTo(dst, uintptr(test.incDst), test.idst, test.a, x, y, uintptr(len(test.ex)), uintptr(test.incX), uintptr(test.incY), test.ix, test.iy)
for i := range test.ex {
if dst[int(test.idst)+i*int(test.incDst)] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, dst[i*int(test.incDst)], test.ex[i])
if dst[int(test.idst)+i*test.incDst] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, dst[i*test.incDst], test.ex[i])
}
}
checkValidIncGuard(t, test.x, xGdVal, test.incX, xgLn)

View File

@@ -249,8 +249,8 @@ func TestAxpyInc(t *testing.T) {
x, y := test.x[xgLn:len(test.x)-xgLn], test.y[ygLn:len(test.y)-ygLn]
AxpyInc(test.a, x, y, uintptr(len(test.ex)), uintptr(test.incX), uintptr(test.incY), test.ix, test.iy)
for i := range test.ex {
if y[int(test.iy)+i*int(test.incY)] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, y[i*int(test.incY)], test.ex[i])
if y[int(test.iy)+i*test.incY] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, y[i*test.incY], test.ex[i])
}
}
checkValidIncGuard(t, test.x, xGdVal, test.incX, xgLn)
@@ -268,8 +268,8 @@ func TestAxpyIncTo(t *testing.T) {
dst := test.dst[xgLn : len(test.dst)-xgLn]
AxpyIncTo(dst, uintptr(test.incDst), test.idst, test.a, x, y, uintptr(len(test.ex)), uintptr(test.incX), uintptr(test.incY), test.ix, test.iy)
for i := range test.ex {
if dst[int(test.idst)+i*int(test.incDst)] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, dst[i*int(test.incDst)], test.ex[i])
if dst[int(test.idst)+i*test.incDst] != test.ex[i] {
t.Errorf("Test %d Unexpected result at %d Got: %v Expected: %v", cas, i, dst[i*test.incDst], test.ex[i])
}
}
checkValidIncGuard(t, test.x, xGdVal, test.incX, xgLn)

View File

@@ -31,7 +31,7 @@ func BenchmarkScalUnitaryTo(t *testing.B) {
tstName := "ScalUnitaryTo"
for _, ln := range uniScal {
t.Run(fmt.Sprintf("%s-%d", tstName, ln), func(b *testing.B) {
b.SetBytes(int64(64 * ln))
b.SetBytes(64 * ln)
x, y := x[:ln], y[:ln]
b.ResetTimer()
for i := 0; i < b.N; i++ {

View File

@@ -402,7 +402,7 @@ func (h Hanowa) Eigenvalues() []complex128 {
if h.N&0x1 != 0 {
panic("lapack: matrix order must be even")
}
n := int(h.N)
n := h.N
ev := make([]complex128, n)
for i := 0; i < n/2; i++ {
ev[2*i] = complex(h.Alpha, float64(-i-1))
@@ -495,7 +495,7 @@ func (t Tris) Matrix() blas64.General {
}
func (t Tris) Eigenvalues() []complex128 {
n := int(t.N)
n := t.N
ev := make([]complex128, n)
for i := range ev {
angle := float64(i+1) * math.Pi / float64(n+1)

View File

@@ -188,7 +188,7 @@ func TestResetCounters(t *testing.T) {
var counts [2]float64
for k := range counts {
rnd := rand.New(rand.NewSource(1))
for i := 0; i < int(test.count); i++ {
for i := 0; i < test.count; i++ {
dst = strconv.AppendUint(dst[:0], rnd.Uint64(), 16)
dst = append(dst, '-')
dst = strconv.AppendUint(dst, uint64(i), 16)
@@ -280,7 +280,7 @@ func TestBinaryEncoding(t *testing.T) {
for _, test := range counterEncoderTests {
rnd := rand.New(rand.NewSource(1))
src := test.src()
for i := 0; i < int(test.count); i++ {
for i := 0; i < test.count; i++ {
buf := strconv.AppendUint(nil, rnd.Uint64(), 16)
buf = append(buf, '-')
buf = strconv.AppendUint(buf, uint64(i), 16)
@@ -408,7 +408,7 @@ func BenchmarkCounters(b *testing.B) {
var dst []byte
b.Run(bench.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
for j := 0; j < int(bench.count); j++ {
for j := 0; j < bench.count; j++ {
dst = strconv.AppendUint(dst[:0], rnd.Uint64(), 16)
dst = append(dst, '-')
dst = strconv.AppendUint(dst, uint64(j), 16)

View File

@@ -20,7 +20,7 @@ func TestAbsorbedRadioactiveDose(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != AbsorbedRadioactiveDose(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.AbsorbedRadioactiveDose() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestAbsorbedRadioactiveDoseFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestAcceleration(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Acceleration(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Acceleration() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestAccelerationFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestAngle(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Angle(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Angle() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestAngleFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestArea(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Area(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Area() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestAreaFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestCapacitance(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Capacitance(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Capacitance() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestCapacitanceFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestCharge(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Charge(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Charge() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestChargeFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestConductance(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Conductance(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Conductance() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestConductanceFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestCurrent(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Current(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Current() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestCurrentFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestDimless(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Dimless(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Dimless() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestDimlessFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestEnergy(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Energy(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Energy() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestEnergyFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestEquivalentRadioactiveDose(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != EquivalentRadioactiveDose(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.EquivalentRadioactiveDose() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestEquivalentRadioactiveDoseFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestForce(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Force(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Force() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestForceFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestFrequency(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Frequency(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Frequency() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestFrequencyFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -604,7 +604,7 @@ func Test{{.DimensionName}}(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != {{.DimensionName}}(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.{{.DimensionName}}() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -633,7 +633,7 @@ func Test{{.DimensionName}}Format(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestInductance(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Inductance(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Inductance() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestInductanceFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestLength(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Length(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Length() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestLengthFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestLuminousIntensity(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != LuminousIntensity(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.LuminousIntensity() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestLuminousIntensityFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestMagneticFlux(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != MagneticFlux(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.MagneticFlux() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestMagneticFluxFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestMagneticFluxDensity(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != MagneticFluxDensity(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.MagneticFluxDensity() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestMagneticFluxDensityFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestMass(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Mass(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Mass() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestMassFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestMole(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Mole(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Mole() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestMoleFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestPower(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Power(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Power() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestPowerFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestPressure(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Pressure(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Pressure() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestPressureFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestRadioactivity(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Radioactivity(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Radioactivity() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestRadioactivityFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestResistance(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Resistance(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Resistance() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestResistanceFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestTemperature(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Temperature(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Temperature() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestTemperatureFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestTime(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Time(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Time() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestTimeFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestTorque(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Torque(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Torque() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestTorqueFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestVelocity(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Velocity(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Velocity() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestVelocityFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestVoltage(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Voltage(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Voltage() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestVoltageFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}

View File

@@ -20,7 +20,7 @@ func TestVolume(t *testing.T) {
t.Errorf("unexpected error for %T conversion: %v", got, err)
}
if got != Volume(value) {
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, float64(value), got, value)
t.Errorf("unexpected result from round trip of %T(%v): got: %v want: %v", got, value, got, value)
}
if got != got.Volume() {
t.Errorf("unexpected result from self interface method call: got: %#v want: %#v", got, value)
@@ -49,7 +49,7 @@ func TestVolumeFormat(t *testing.T) {
} {
got := fmt.Sprintf(test.format, test.value)
if got != test.want {
t.Errorf("Format %q %v: got: %q want: %q", test.format, float64(test.value), got, test.want)
t.Errorf("Format %q %v: got: %q want: %q", test.format, test.value, got, test.want)
}
}
}