MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_array_functions

Function test_array_functions

src/functions/array_functions.rs:814–849  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

812
813 #[test]
814 fn test_array_functions() {
815 let conn = Connection::open_in_memory().unwrap();
816 register_array_functions(&conn).unwrap();
817
818 // Test array_length
819 let len: i32 = conn.query_row(
820 "SELECT array_length('[1,2,3,4,5]', 1)",
821 [],
822 |row| row.get(0)
823 ).unwrap();
824 assert_eq!(len, 5);
825
826 // Test array_append
827 let result: String = conn.query_row(
828 "SELECT array_append('[1,2,3]', '4')",
829 [],
830 |row| row.get(0)
831 ).unwrap();
832 assert_eq!(result, "[1,2,3,4]");
833
834 // Test array_contains
835 let contains: bool = conn.query_row(
836 "SELECT array_contains('[1,2,3,4,5]', '[2,3]')",
837 [],
838 |row| row.get(0)
839 ).unwrap();
840 assert!(contains);
841
842 // Test array_overlap
843 let overlap: bool = conn.query_row(
844 "SELECT array_overlap('[1,2,3]', '[3,4,5]')",
845 [],
846 |row| row.get(0)
847 ).unwrap();
848 assert!(overlap);
849 }
850}

Callers

nothing calls this directly

Calls 2

register_array_functionsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected