[asterisk-dev] [Code Review]: Doubly linked lists unit test and update to implementation.

rmudgett reviewboard at asterisk.org
Wed Nov 23 12:49:29 CST 2011



> On Nov. 23, 2011, 11:57 a.m., mjordan wrote:
> > /trunk/tests/test_linkedlists.c, line 342
> > <https://reviewboard.asterisk.org/r/1569/diff/1/?file=21639#file21639line342>
> >
> >     What is the expected behavior if you attempt to insert a NULL item?  Is that handled by the list (if so, we should test for it), or do we expect that to error out when attempting to access the item later?

You cannot add a NULL item to the single or doubly linked lists.  A segfault is the result so don't do it.  Testing for a NULL item is not really needed because you should already have tested if your new item allocation was successful.


> On Nov. 23, 2011, 11:57 a.m., mjordan wrote:
> > /trunk/tests/test_linkedlists.c, line 491
> > <https://reviewboard.asterisk.org/r/1569/diff/1/?file=21639#file21639line491>
> >
> >     I'd say this is traversal and modification - which is a bit different then just testing that you iterate across the elements correctly

Yes.  It is exercising a lot of code but it is not able to verify that it can iterate over the list.  It is able to verify the list modifications.


- rmudgett


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1569/#review4855
-----------------------------------------------------------


On Nov. 5, 2011, 5:32 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1569/
> -----------------------------------------------------------
> 
> (Updated Nov. 5, 2011, 5:32 p.m.)
> 
> 
> Review request for Asterisk Developers and Terry Wilson.
> 
> 
> Summary
> -------
> 
> Update the doubly linked list implementation.  Now safe traversing can insert before and after the current node when traversing in either direction.
> 
> Updated the linked lists unit test test_linkedlist to also test doubly linked lists.  The old test_dlinkedlist requires a manual check of results and probably should be removed.
> 
> Asterisk currently only uses a small subset of the doubly linked lists macro implementation.  It only uses doubly linked lists for the event subscriptions module.
> 
> 
> Diffs
> -----
> 
>   /trunk/tests/test_linkedlists.c 343488 
>   /trunk/include/asterisk/dlinkedlists.h 343488 
> 
> Diff: https://reviewboard.asterisk.org/r/1569/diff
> 
> 
> Testing
> -------
> 
> Old and new unit tests pass.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111123/6c0c2a2e/attachment-0001.htm>


More information about the asterisk-dev mailing list