From ec23771789f524c157f61d6a34aa0ba183ad1d54 Mon Sep 17 00:00:00 2001 From: DanB Date: Thu, 17 Oct 2024 13:20:26 +0200 Subject: [PATCH] Enhanced TestRankingDescSorterSortStatIDs --- engine/librankings_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/librankings_test.go b/engine/librankings_test.go index 3102cd963..5fe4e8cbb 100644 --- a/engine/librankings_test.go +++ b/engine/librankings_test.go @@ -28,16 +28,17 @@ func TestRankingDescSorterSortStatIDs(t *testing.T) { "STATS1": {"*acc": 12.1, "*tcc": 24.2}, "STATS2": {"*acc": 12.1, "*tcc": 24.3}, "STATS3": {"*acc": 10.1, "*tcc": 25.3}, + "STATS4": {"*tcc": 26.3}, } sortMetrics := []string{"*acc", "*tcc"} - rdscSrtr := newRankingDescSorter(sortMetrics,statMetrics) - eStatIDs := []string{"STATS2", "STATS1", "STATS3"} + rdscSrtr := newRankingDescSorter(sortMetrics, statMetrics) + eStatIDs := []string{"STATS2", "STATS1", "STATS3", "STATS4"} if statIDs := rdscSrtr.sortStatIDs(); !reflect.DeepEqual(eStatIDs, statIDs) { t.Errorf("Expecting: %v, received %v", eStatIDs, statIDs) } - sortMetrics = []string{"*tcc", "*acc"} // changed the order of checks, stats3 should come first - rdscSrtr = newRankingDescSorter(sortMetrics,statMetrics) - eStatIDs = []string{"STATS3", "STATS2", "STATS1"} + sortMetrics = []string{"*tcc", "*acc"} // changed the order of checks, stats4 should come first + rdscSrtr = newRankingDescSorter(sortMetrics, statMetrics) + eStatIDs = []string{"STATS4", "STATS3", "STATS2", "STATS1"} if statIDs := rdscSrtr.sortStatIDs(); !reflect.DeepEqual(eStatIDs, statIDs) { t.Errorf("Expecting: %v, received %v", eStatIDs, statIDs) }