@@ -69,7 +69,7 @@ func TestList_Set(t *testing.T) {
69
69
}
70
70
71
71
// Verify list state hasn't changed after invalid operations
72
- expected := []interface{} {1, 42, 3, 4}
72
+ expected := []any {1, 42, 3, 4}
73
73
for i, want := range expected {
74
74
if got := l.Get(i); got != want {
75
75
t.Errorf("index %d = %v; want %v", i, got, want)
@@ -107,16 +107,16 @@ func TestList_Slice(t *testing.T) {
107
107
108
108
// Test valid ranges
109
109
values := l.Slice(1, 4)
110
- expected := []interface{} {2, 3, 4}
110
+ expected := []any {2, 3, 4}
111
111
if !sliceEqual(values, expected) {
112
112
t.Errorf("Slice(1,4) = %v; want %v", values, expected)
113
113
}
114
114
115
115
// Test edge cases
116
- if values := l.Slice(-1, 2); !sliceEqual(values, []interface{} {1, 2}) {
116
+ if values := l.Slice(-1, 2); !sliceEqual(values, []any {1, 2}) {
117
117
t.Errorf("Slice(-1,2) = %v; want [1 2]", values)
118
118
}
119
- if values := l.Slice(3, 10); !sliceEqual(values, []interface{} {4, 5}) {
119
+ if values := l.Slice(3, 10); !sliceEqual(values, []any {4, 5}) {
120
120
t.Errorf("Slice(3,10) = %v; want [4 5]", values)
121
121
}
122
122
if values := l.Slice(3, 2); values != nil {
@@ -129,7 +129,7 @@ func TestList_ForEach(t *testing.T) {
129
129
l.Append(1, 2, 3)
130
130
131
131
sum := 0
132
- l.ForEach(func(index int, value interface{} ) bool {
132
+ l.ForEach(func(index int, value any ) bool {
133
133
sum += value.(int)
134
134
return false
135
135
})
@@ -140,7 +140,7 @@ func TestList_ForEach(t *testing.T) {
140
140
141
141
// Test early termination
142
142
count := 0
143
- l.ForEach(func(index int, value interface{} ) bool {
143
+ l.ForEach(func(index int, value any ) bool {
144
144
count++
145
145
return true // stop after first item
146
146
})
@@ -187,7 +187,7 @@ func TestList_DeleteRange(t *testing.T) {
187
187
if l.Len() != 2 {
188
188
t.Errorf("after DeleteRange(1,4) len = %d; want 2", l.Len())
189
189
}
190
- expected := []interface{} {1, 5}
190
+ expected := []any {1, 5}
191
191
for i, want := range expected {
192
192
if got := l.Get(i); got != want {
193
193
t.Errorf("after DeleteRange(1,4) index %d = %v; want %v", i, got, want)
@@ -281,7 +281,7 @@ func TestList_LargeOperations(t *testing.T) {
281
281
282
282
// Test range on large list
283
283
values := l.Slice(n-3, n)
284
- expected := []interface{} {n - 3, n - 2, n - 1}
284
+ expected := []any {n - 3, n - 2, n - 1}
285
285
if !sliceEqual(values, expected) {
286
286
t.Errorf("Range(%d,%d) = %v; want %v", n-3, n, values, expected)
287
287
}
@@ -305,7 +305,7 @@ func TestList_ChainedOperations(t *testing.T) {
305
305
l.Append(4)
306
306
l.Set(1, 5)
307
307
308
- expected := []interface{} {1, 5, 4}
308
+ expected := []any {1, 5, 4}
309
309
for i, want := range expected {
310
310
if got := l.Get(i); got != want {
311
311
t.Errorf("index %d = %v; want %v", i, got, want)
@@ -320,10 +320,10 @@ func TestList_RangeEdgeCases(t *testing.T) {
320
320
// Test various edge cases for Range
321
321
cases := []struct {
322
322
start, end int
323
- want []interface{}
323
+ want []any
324
324
}{
325
- {-10, 2, []interface{} {1, 2}},
326
- {3, 10, []interface{} {4, 5}},
325
+ {-10, 2, []any {1, 2}},
326
+ {3, 10, []any {4, 5}},
327
327
{0, 0, nil},
328
328
{5, 5, nil},
329
329
{4, 3, nil},
@@ -357,7 +357,7 @@ func TestList_IndexConsistency(t *testing.T) {
357
357
l.Append(8, 9, 10) // [1,6,7,8,9,10]
358
358
359
359
// Verify sequence is continuous
360
- expected := []interface{} {1, 6, 7, 8, 9, 10}
360
+ expected := []any {1, 6, 7, 8, 9, 10}
361
361
for i, want := range expected {
362
362
if got := l.Get(i); got != want {
363
363
t.Errorf("index %d = %v; want %v", i, got, want)
@@ -376,9 +376,9 @@ func TestList_IndexConsistency(t *testing.T) {
376
376
}
377
377
378
378
// Verify no gaps in iteration
379
- var iteratedValues []interface{}
379
+ var iteratedValues []any
380
380
var indices []int
381
- l.ForEach(func(index int, value interface{} ) bool {
381
+ l.ForEach(func(index int, value any ) bool {
382
382
iteratedValues = append(iteratedValues, value)
383
383
indices = append(indices, index)
384
384
return false
@@ -408,7 +408,7 @@ func TestList_RecursiveSafety(t *testing.T) {
408
408
409
409
// Test deep list traversal
410
410
found := false
411
- l.ForEach(func(i int, v interface{} ) bool {
411
+ l.ForEach(func(i int, v any ) bool {
412
412
if str, ok := v.(string); ok {
413
413
if str == "id2" {
414
414
found = true
@@ -432,7 +432,7 @@ func TestList_RecursiveSafety(t *testing.T) {
432
432
if !short {
433
433
// Search for a value
434
434
var lastFound bool
435
- l.ForEach(func(j int, v interface{} ) bool {
435
+ l.ForEach(func(j int, v any ) bool {
436
436
if str, ok := v.(string); ok {
437
437
if str == ufmt.Sprintf("id%d", i+3) {
438
438
lastFound = true
@@ -460,7 +460,7 @@ func TestList_RecursiveSafety(t *testing.T) {
460
460
}
461
461
462
462
// Helper function to compare slices
463
- func sliceEqual(a, b []interface{} ) bool {
463
+ func sliceEqual(a, b []any ) bool {
464
464
if len(a) != len(b) {
465
465
return false
466
466
}
0 commit comments