Implement growable stack and max-depth tracking (#8)#10
Implement growable stack and max-depth tracking (#8)#10HossamSaberr wants to merge 3 commits intopharo-containers:masterfrom
Conversation
|
I like this PR! Could you add more tests to test the internals? The same for CTTrackedGrowableStack we need to tests the internals as well of the external API :) |
|
I have added the internal tests, I wrote tests that verify the internal OrderedCollection's capacity successfully doubles from 4 to 8 when the 5th element is added All Green! |
virenvarma007
left a comment
There was a problem hiding this comment.
Great work on this PR.
You addressed Jordan’s request with explicit internal tests for capacity growth from 4 to 8 on the 5th push in both CTGrowableStack and CTTrackedGrowableStack, plus good max-depth coverage.
I ran all tests locally and they passed, including one extra personal local test.
Minor non-blocking nit: remove the unused initialCapacity temp in CTGrowableStackTest>>testInternalGrowth.
Looks good to approve.
|
Thanks for the review and the approval! I just pushed a quick commit to remove that unused |
This closes #8.
Overview
This PR fix the issue by introducing a growable stack implementation .
Changes
maxDepthinstance variable. It overridespush:to track the high-water mark of the stack's size during its lifecycle.CTGrowableStackTestfor basic LIFO verification.CTTrackedGrowableStackTestto verify thatmaxDepthcorrectly records the peak size even after elements are popped.and all tests are green!