Various tests for count() with sort/limit/skip.

Patch by: Ted Blackman <ted.blackman@gmail.com>

(Ted fixed a bug on devel that was preventing these tests from passing. On the
ddp-pre1 branch, the bug was fixed in a different way, but the tests are still
useful.)