these 2 tests are failing
this is the earlier discussion about it
am using 2 stacks one to perform undo and other to perform redo operation.
when I debugged it and found this;
- abcdefgh is the first version
- editlines is called and its changed to abc12fgh (let “de” be the two lines that are updated)
- now I have both of these versions in my undostack, (redostack is empty here)
- when undo method is called. I popped abc12fgh from my undostack and pushed it on to redostack
- and my logic returns abcdefgh ie top element of my undostack in this case
according to the assertion, it says abc12fgh is the version to be returned in this case. (at this point I have it in redostack & if I use that, other test cases will fail) I dint understand why it is so. I thought it is expecting to revert a single line change but that’s not the case.
and I found that it can be passed if at all top element of my undostack has latest edited version.(but other cases fails) and according to me abcdefgh is the version to be returned in above case.
even with the other test similar thing is happening. 1st editlines is called and a line is added and in searchreplace (we replace “LINENUMBER” to “lineno” here) the added line is changed from LINENUM101 to lineno101. At this point my logic returns latest version but it expects an earlier version with LINENUM101 but not the recent one. according to my approach it has to be the latest version.
I already spent a lot of time on this. definitely there’s some mistake with the way am thinking about it. But unable to understand what it is.