complex unit test for inv