Tests for aggregate operator

See #548