MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestFunctionsArray

Function TestFunctionsArray

tests/integration/functions_test.go:304–327  ·  view source on GitHub ↗

TestFunctionsArray tests array functions

(t *testing.T)

Source from the content-addressed store, hash-verified

302
303// TestFunctionsArray tests array functions
304func TestFunctionsArray(t *testing.T) {
305 tests := []QueryTest{
306 // Information
307 {Name: "array_length", Query: "SELECT array_length(ARRAY[1, 2, 3], 1)"},
308 {Name: "array_ndims", Query: "SELECT array_ndims(ARRAY[[1, 2], [3, 4]])"},
309 {Name: "cardinality", Query: "SELECT cardinality(ARRAY[1, 2, 3])"},
310
311 // Search
312 {Name: "array_position", Query: "SELECT array_position(ARRAY['a', 'b', 'c'], 'b')"},
313
314 // Modification
315 {Name: "array_append", Query: "SELECT array_append(ARRAY[1, 2], 3)"},
316 {Name: "array_prepend", Query: "SELECT array_prepend(0, ARRAY[1, 2])"},
317 {Name: "array_cat", Query: "SELECT array_cat(ARRAY[1, 2], ARRAY[3, 4])"},
318 {Name: "array_remove", Query: "SELECT array_remove(ARRAY[1, 2, 1], 1)"},
319 {Name: "array_replace", Query: "SELECT array_replace(ARRAY[1, 2, 1], 1, 10)"},
320
321 // Transformation
322 {Name: "unnest", Query: "SELECT unnest(ARRAY[1, 2, 3])"},
323 {Name: "array_to_string", Query: "SELECT array_to_string(ARRAY[1, 2, 3], ',')"},
324 {Name: "string_to_array", Query: "SELECT string_to_array('1,2,3', ',')"},
325 }
326 runQueryTests(t, tests)
327}
328
329// TestFunctionsConditional tests conditional functions
330func TestFunctionsConditional(t *testing.T) {

Callers

nothing calls this directly

Calls 1

runQueryTestsFunction · 0.85

Tested by

no test coverage detected