Update dependencies

This commit is contained in:
Zlatko Čalušić
2018-01-21 19:43:52 +01:00
parent 0a5606e954
commit 9ef84dcdea
27 changed files with 507 additions and 51 deletions

View File

@@ -61,7 +61,7 @@ func dehumanize(hbytes []byte) (uint64, error) {
mul := float64(1)
var (
mant float64
err error
err error
)
// If lastByte is beyond the range of ASCII digits, it must be a
// multiplier.
@@ -93,7 +93,7 @@ func dehumanize(hbytes []byte) (uint64, error) {
'Z': ZiB,
'Y': YiB,
}
mul = float64(multipliers[rune(lastByte)])
mul = multipliers[rune(lastByte)]
mant, err = parsePseudoFloat(string(hbytes))
if err != nil {
return 0, err
@@ -139,10 +139,10 @@ func (p *parser) readValue(fileName string) uint64 {
}
// ParsePriorityStats parses lines from the priority_stats file.
func parsePriorityStats(line string, ps *PriorityStats) (error) {
func parsePriorityStats(line string, ps *PriorityStats) error {
var (
value uint64
err error
err error
)
switch {
case strings.HasPrefix(line, "Unused:"):

View File

@@ -14,8 +14,8 @@
package bcache
import (
"testing"
"math"
"testing"
)
func TestDehumanizeTests(t *testing.T) {
@@ -45,8 +45,8 @@ func TestDehumanizeTests(t *testing.T) {
out: 2024,
},
{
in: []byte(""),
out: 0,
in: []byte(""),
out: 0,
invalid: true,
},
}
@@ -59,7 +59,7 @@ func TestDehumanizeTests(t *testing.T) {
t.Errorf("unexpected error: %v", err)
}
if got != tst.out {
t.Errorf("dehumanize: '%s', want %f, got %f", tst.in, tst.out, got)
t.Errorf("dehumanize: '%s', want %d, got %d", tst.in, tst.out, got)
}
}
}
@@ -84,7 +84,7 @@ func TestParsePseudoFloatTests(t *testing.T) {
}
for _, tst := range parsePseudoFloatTests {
got, err := parsePseudoFloat(tst.in)
if err != nil || math.Abs(got - tst.out) > 0.0001 {
if err != nil || math.Abs(got-tst.out) > 0.0001 {
t.Errorf("parsePseudoFloat: %s, want %f, got %f", tst.in, tst.out, got)
}
}
@@ -92,23 +92,23 @@ func TestParsePseudoFloatTests(t *testing.T) {
func TestPriorityStats(t *testing.T) {
var want = PriorityStats{
UnusedPercent: 99,
UnusedPercent: 99,
MetadataPercent: 5,
}
var (
in string
in string
gotErr error
got PriorityStats
got PriorityStats
)
in = "Metadata: 5%"
gotErr = parsePriorityStats(in, &got)
if gotErr != nil || got.MetadataPercent != want.MetadataPercent {
t.Errorf("parsePriorityStats: '%s', want %f, got %f", in, want.MetadataPercent, got.MetadataPercent)
t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.MetadataPercent, got.MetadataPercent)
}
in = "Unused: 99%"
gotErr = parsePriorityStats(in, &got)
if gotErr != nil || got.UnusedPercent != want.UnusedPercent {
t.Errorf("parsePriorityStats: '%s', want %f, got %f", in, want.UnusedPercent, got.UnusedPercent)
t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.UnusedPercent, got.UnusedPercent)
}
}