The ARRAY_LENGTH macro is used by many tests, although sometimes it is
named ARRAY_SIZE. Define it just once in cairo-test.h and reuse it.
In a similar way, MAX() and MIN() are currently defined in some
specific tests, while they could be reused.
In that check, we call functions that require a specific surface type
with surfaces of a different type and check that they don't crash and
set the correct error.
In particular, it checks that finished and surfaces in an error state do
not do bad things, like cause crashes.
So far this test only checks surface APIs, but it should be extended to
cover all APIs.
Please update this test when new APIs get added.
Motivated by https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/600622