Add query generation tests