Test query functions.