Add mock() function.

Using the mock() function relieves the used from having to
remember to call .check() on each mock object at the end
of tests.