Add a whole bunch of tests for querying from sample programs.