(t *testing.T)
| 882 | } |
| 883 | |
| 884 | func TestFZSetMinMax(t *testing.T) { |
| 885 | fzs := &FZSet{ |
| 886 | skipList: newSkipList(), |
| 887 | } |
| 888 | _ = fzs.InsertNode(1, "mem1", "") |
| 889 | _ = fzs.InsertNode(100, "mem2", "") |
| 890 | |
| 891 | minScore, maxScore := fzs.getMinMaxScore() |
| 892 | |
| 893 | if minScore != 1 || maxScore != 100 { |
| 894 | t.Errorf("getMinMaxScore() = %d, %d, want: 1, 100", minScore, maxScore) |
| 895 | } |
| 896 | |
| 897 | if min := fzs.min(5, 10); min != 5 { |
| 898 | t.Errorf("min(5, 10) = %d, want: 5", min) |
| 899 | } |
| 900 | |
| 901 | if max := fzs.max(5, 10); max != 10 { |
| 902 | t.Errorf("max(5, 10) = %d, want: 10", max) |
| 903 | } |
| 904 | |
| 905 | // if case part of skip list is missing, we should return 0,0 |
| 906 | fzs.skipList.tail.value = nil |
| 907 | minScore, maxScore = fzs.getMinMaxScore() |
| 908 | assert.Equal(t, minScore, 0) |
| 909 | assert.Equal(t, maxScore, 0) |
| 910 | // again, an error case |
| 911 | fzs.skipList = nil |
| 912 | minScore, maxScore = fzs.getMinMaxScore() |
| 913 | assert.Equal(t, minScore, 0) |
| 914 | assert.Equal(t, maxScore, 0) |
| 915 | |
| 916 | } |
| 917 | func TestZSetStructure_adjustMinMax(t *testing.T) { |
| 918 | zss, _ := NewZSetStructure(config.DefaultOptions) |
| 919 | fz := newZSetNodes() |
nothing calls this directly
no test coverage detected