[#88] netmap: use bool, fix hrw_sort tests
All checks were successful
DCO / DCO (pull_request) Successful in 1m2s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m12s
Tests and linters / Lint (pull_request) Successful in 3m17s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m33s

Signed-off-by: Andrew Danilin <andnilin@gmail.com>
This commit is contained in:
andnilin@gmail.com 2023-09-16 17:03:38 +03:00
parent d13062b811
commit c0780510aa
2 changed files with 15 additions and 12 deletions

View file

@ -23,7 +23,8 @@ type (
}
minAgg struct {
min *float64
min float64
minFound bool
}
meanIQRAgg struct {
@ -102,17 +103,19 @@ func (a *meanAgg) Compute() float64 {
}
func (a *minAgg) Add(n float64) {
if a.min == nil || n < *a.min {
a.min = &n
if !a.minFound {
a.min = n
a.minFound = true
return
}
if n < a.min {
a.min = n
}
}
func (a *minAgg) Compute() float64 {
if a.min == nil {
return 0
}
return *a.min
return a.min
}
func (a *meanIQRAgg) Add(n float64) {

View file

@ -146,19 +146,19 @@
"select 3 nodes in 3 distinct countries, same placement": {
"policy": {"replicas":[{"count":1,"selector":"Main"}],"containerBackupFactor":1,"selectors":[{"name":"Main","count":3,"clause":"DISTINCT","attribute":"Country","filter":"*"}],"filters":[]},
"pivot": "Y29udGFpbmVySUQ=",
"result": [[4, 0, 7]],
"result": [[0, 2, 3]],
"placement": {
"pivot": "b2JqZWN0SUQ=",
"result": [[4, 0, 7]]
"result": [[0, 2, 3]]
}
},
"select 6 nodes in 3 distinct countries, different placement": {
"policy": {"replicas":[{"count":1,"selector":"Main"}],"containerBackupFactor":2,"selectors":[{"name":"Main","count":3,"clause":"DISTINCT","attribute":"Country","filter":"*"}],"filters":[]},
"pivot": "Y29udGFpbmVySUQ=",
"result": [[4, 3, 0, 1, 7, 2]],
"result": [[0, 1, 2, 6, 3, 4]],
"placement": {
"pivot": "b2JqZWN0SUQ=",
"result": [[4, 3, 0, 7, 2, 1]]
"result": [[0, 1, 2, 6, 3, 4]]
}
}
}