(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestShouldInternColumn(t *testing.T) { |
| 52 | tests := []struct { |
| 53 | name string |
| 54 | values []string |
| 55 | threshold float64 |
| 56 | expected bool |
| 57 | }{ |
| 58 | { |
| 59 | name: "High cardinality - should not intern", |
| 60 | values: generateUniqueStrings(1000), |
| 61 | threshold: 0.30, |
| 62 | expected: false, |
| 63 | }, |
| 64 | { |
| 65 | name: "Low cardinality - should intern", |
| 66 | values: generateRepeatedStrings(1000, 10), |
| 67 | threshold: 0.30, |
| 68 | expected: true, |
| 69 | }, |
| 70 | { |
| 71 | name: "Too small - should not intern", |
| 72 | values: []string{"a", "b", "c"}, |
| 73 | threshold: 0.30, |
| 74 | expected: false, |
| 75 | }, |
| 76 | { |
| 77 | name: "Medium cardinality at threshold", |
| 78 | values: generateRepeatedStrings(1000, 300), |
| 79 | threshold: 0.30, |
| 80 | expected: false, |
| 81 | }, |
| 82 | } |
| 83 | |
| 84 | for _, tt := range tests { |
| 85 | t.Run(tt.name, func(t *testing.T) { |
| 86 | result := shouldInternColumn(tt.values, tt.threshold) |
| 87 | if result != tt.expected { |
| 88 | t.Errorf("shouldInternColumn() = %v, want %v", result, tt.expected) |
| 89 | } |
| 90 | }) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestBufferStringInterning(t *testing.T) { |
| 95 | // Create test data with repeated categorical values |
nothing calls this directly
no test coverage detected