Code shrink in object.c.
Fixes some const correctness issues.
Reworked the regression tests and added the first scenario.