mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
fix test
This commit is contained in:
@@ -94,7 +94,8 @@ func GenerateFromBlockStore(s BlockStore) (Report, error) {
|
||||
r.All = append(r.All, pd.l)
|
||||
if pd.l > r.Max {
|
||||
r.Max = pd.l
|
||||
} else if pd.l < r.Min {
|
||||
}
|
||||
if pd.l < r.Min {
|
||||
r.Min = pd.l
|
||||
}
|
||||
// Using an int64 here makes an assumption about the scale and quantity of the data we are processing.
|
||||
|
||||
@@ -74,14 +74,15 @@ func TestGenerateReport(t *testing.T) {
|
||||
t.Fatalf("Avg did not match expected. Expected %s but contained %s", 5*time.Second, r.Avg)
|
||||
}
|
||||
if r.Min != 4*time.Second {
|
||||
t.Fatalf("Avg did not match expected. Expected %s but contained %s", 4*time.Second, r.Min)
|
||||
t.Fatalf("Min did not match expected. Expected %s but contained %s", 4*time.Second, r.Min)
|
||||
}
|
||||
if r.Max != 6*time.Second {
|
||||
t.Fatalf("Avg did not match expected. Expected %s but contained %s", 6*time.Second, r.Max)
|
||||
t.Fatalf("Max did not match expected. Expected %s but contained %s", 6*time.Second, r.Max)
|
||||
}
|
||||
// Verified using online standard deviation calculator:
|
||||
// https://www.calculator.net/standard-deviation-calculator.html?numberinputs=6%2C+4&ctype=p&x=84&y=27
|
||||
if r.StdDev != time.Second {
|
||||
t.Fatalf("StdDev did not match expected. Expected %s but contained %s", time.Second, r.StdDev)
|
||||
expectedStdDev := 1414213562 * time.Nanosecond
|
||||
if r.StdDev != expectedStdDev {
|
||||
t.Fatalf("StdDev did not match expected. Expected %s but contained %s", expectedStdDev, r.StdDev)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user