Re: stack.e functions

new topic     » goto parent     » topic index » view thread      » older message » newer message

Larry Miller wrote:
> 
> I was looking at the functions defined in stack.e on SourceForge and found 2
> problems. push() will not word properly if value is a sequence. dup() will not
> work properly if the top element is a sequence.
> 
> The corrected functions:

Thanks Larry! This is what the standard libraries are all about!

I added a few tests to exploit the bug you found:

sk = s:push(sk, {10,20})
test_equal("FIFO push sequence #1", {FILO, {10,20}}, sk)
sk = s:push(sk, {30,40})
test_equal("FIFO push sequence #3", {FILO, {10,20},{30,40}}, sk)
sk = s:dup(sk)
test_equal("FIFO dup sequence", {FILO, {10,20},{30,40},{30,40}}, sk)


I then applied replaced the dup and push functions with your variants and all
tests pass again. The changes have been committed to SVN.

579 tests run, 579 passed, 0 failed, 100% success

--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu