On Thu, Aug 29, 2013 at 8:54 AM, Igor Stasenko <siguctua@gmail.com> wrote:
 
Hello,

i tried to implement a simple algorithm to find nearest common roots for some object(s)..
see the attached code.

The problem i discovered that the last assertion of my test fails:
=====
testArrayShouldBeRootOfItsElements

    | obj1 obj2 array arrayToTest roots |
   
    obj1 := 'ObjectA' copy.
    obj2 := 'ObjectB' copy.
   
    array := {  obj1. obj2 }.
    arrayToTest := { obj1. obj2 }.
   
    roots := CommonRootsFinder new findCommonRootsOf:  arrayToTest.
   
    self assert: (roots identityIncludes: array).
    self assert: (roots identityIncludes: arrayToTest) not.
    self assert: (roots identityIncludes: thisContext).  "- sometimes works , sometimes not "
========

but, when i restart the method in debugger and step down through it, assertion DOES NOT fails.
This means that memory scan does not reveals this context as it should be.

(maybe because it stops at the object which located before location of thisContext)?

That would make sense.  For debugging, why don't you record the objects visited in an OrderedCollection, and then you can look at what order the pointer finder found them.
 

any suggestions/comments/ideas , how to make sure that assert will never fail?

Doesn't that depend on how you've implemented CommonRootsFinder?


--
Best regards,
Igor Stasenko.




--
best,
Eliot