SonarQube fixes

This commit is contained in:
Emir Pasic 2022-04-13 19:40:28 +02:00
parent 6356a9e470
commit 1dd397e12c
3 changed files with 48 additions and 216 deletions

View File

@ -269,15 +269,8 @@ func TestAVLTreeIterator1Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -308,15 +301,8 @@ func TestAVLTreeIterator1Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -335,15 +321,8 @@ func TestAVLTreeIterator2Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -362,15 +341,8 @@ func TestAVLTreeIterator2Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -387,15 +359,8 @@ func TestAVLTreeIterator3Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -412,15 +377,8 @@ func TestAVLTreeIterator3Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -456,15 +414,8 @@ func TestAVLTreeIterator4Next(t *testing.T) {
for it.Next() {
count++
value := it.Value()
switch value {
case count:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -500,15 +451,8 @@ func TestAVLTreeIterator4Prev(t *testing.T) {
}
for it.Prev() {
value := it.Value()
switch value {
case count:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
count--
}

View File

@ -749,15 +749,8 @@ func TestBTreeIterator1Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -781,15 +774,8 @@ func TestBTreeIterator1Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -808,15 +794,8 @@ func TestBTreeIterator2Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -835,15 +814,8 @@ func TestBTreeIterator2Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -860,15 +832,8 @@ func TestBTreeIterator3Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -885,15 +850,8 @@ func TestBTreeIterator3Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -919,15 +877,8 @@ func TestBTreeIterator4Next(t *testing.T) {
for it.Next() {
count++
value := it.Value()
switch value {
case count:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -953,15 +904,8 @@ func TestBTreeIterator4Prev(t *testing.T) {
}
for it.Prev() {
value := it.Value()
switch value {
case count:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
count--
}

View File

@ -271,15 +271,8 @@ func TestRedBlackTreeIterator1Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -310,15 +303,8 @@ func TestRedBlackTreeIterator1Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -337,15 +323,8 @@ func TestRedBlackTreeIterator2Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -364,15 +343,8 @@ func TestRedBlackTreeIterator2Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -389,15 +361,8 @@ func TestRedBlackTreeIterator3Next(t *testing.T) {
for it.Next() {
count++
key := it.Key()
switch key {
case count:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -414,15 +379,8 @@ func TestRedBlackTreeIterator3Prev(t *testing.T) {
countDown := tree.size
for it.Prev() {
key := it.Key()
switch key {
case countDown:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := key, countDown; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
countDown--
}
@ -458,15 +416,8 @@ func TestRedBlackTreeIterator4Next(t *testing.T) {
for it.Next() {
count++
value := it.Value()
switch value {
case count:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
}
if actualValue, expectedValue := count, tree.Size(); actualValue != expectedValue {
@ -502,15 +453,8 @@ func TestRedBlackTreeIterator4Prev(t *testing.T) {
}
for it.Prev() {
value := it.Value()
switch value {
case count:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
default:
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
if actualValue, expectedValue := value, count; actualValue != expectedValue {
t.Errorf("Got %v expected %v", actualValue, expectedValue)
}
count--
}