Hoist the check that we've scanned all the unrs to the top of the
loop since none might have been allocated e.g., if we've only used
allocated units in order with alloc_unr() and never free'd any.
Add a test of the trivial case.
Fixes: a014e0a3987a ("unr(9): add iterator interface")
Sponsored by: Innovate UK