(t *testing.T)
| 188 | } |
| 189 | |
| 190 | func TestInternValue(t *testing.T) { |
| 191 | b := createNewBuffer() |
| 192 | b.colLen = 2 |
| 193 | b.interners = make([]*stringInterner, 2) |
| 194 | b.internCols = make([]bool, 2) |
| 195 | |
| 196 | // Enable interning for column 0 |
| 197 | b.interners[0] = newStringInterner() |
| 198 | b.internCols[0] = true |
| 199 | |
| 200 | // Test interning |
| 201 | val1 := b.internValue(0, "test") |
| 202 | val2 := b.internValue(0, "test") |
| 203 | |
| 204 | // Should be same value for column 0 |
| 205 | if val1 != val2 { |
| 206 | t.Error("Interned values should be same value") |
| 207 | } |
| 208 | |
| 209 | // Verify it's actually in the interner |
| 210 | count := 0 |
| 211 | b.interners[0].pool.Range(func(key, value interface{}) bool { |
| 212 | count++ |
| 213 | return true |
| 214 | }) |
| 215 | |
| 216 | if count != 1 { |
| 217 | t.Errorf("Expected 1 entry in interner, got %d", count) |
| 218 | } |
| 219 | |
| 220 | // Column 1 not interned, should return original |
| 221 | val3 := b.internValue(1, "test") |
| 222 | if val3 != "test" { |
| 223 | t.Error("Non-interned column should return original value") |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | // Helper functions |
| 228 | func generateUniqueStrings(count int) []string { |
nothing calls this directly
no test coverage detected