fix checked_as_defined/checked_as_undefined computing
move required-related logic tests to a separate module