def assert_invariants(testcase)
      fields.each do |field|
        if val = send(field.reader)
          assert_same(self, node.parent, "field.reader is #{field.reader}")
          if field.child?
            assert_same(field, val.instance_variable_get(:@parent_field), "field.reader is #{field.reader}")
          end
        end
      end
    end
def assert_invariants(testcase)
      fields.each do |field|
        if val = send(field.reader)
          assert_same(self, node.parent, "field.reader is #{field.reader}")
          if field.child?
            assert_same(field, val.instance_variable_get(:@parent_field), "field.reader is #{field.reader}")
          end
        end
      end
    end
Called by the test suite to ensure all invariants are true.