[prev in list] [next in list] [prev in thread] [next in thread]
List: asterisk-dev
Subject: Re: [asterisk-dev] [Code Review]: Doubly linked lists unit test and
From: "rmudgett" <reviewboard () asterisk ! org>
Date: 2011-11-23 18:49:29
Message-ID: 20111123184929.6584.1261 () hotblack ! digium ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> 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
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1569/">https://reviewboard.asterisk.org/r/1569/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On November 23rd, 2011, 11:57 a.m., <b>mjordan</b> \
wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://reviewboard.asterisk.org/r/1569/diff/1/?file=21639#file21639line342" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/tests/test_linkedlists.c</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">AST_TEST_DEFINE(double_ll_tests)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">342</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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?</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On November 23rd, 2011, 11:57 a.m., <b>mjordan</b> \
wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://reviewboard.asterisk.org/r/1569/diff/1/?file=21639#file21639line491" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/tests/test_linkedlists.c</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">AST_TEST_DEFINE(double_ll_tests)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">491</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="cm">/* Traverse starting from first element */</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'd say this is \
traversal and modification - which is a bit different then just testing that you \
iterate across the elements correctly</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre> <br />
<p>- rmudgett</p>
<br />
<p>On November 5th, 2011, 5:32 p.m., rmudgett wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Asterisk Developers and Terry Wilson.</div>
<div>By rmudgett.</div>
<p style="color: grey;"><i>Updated Nov. 5, 2011, 5:32 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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. \
</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Old and new unit tests pass. </pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/tests/test_linkedlists.c <span style="color: grey">(343488)</span></li>
<li>/trunk/include/asterisk/dlinkedlists.h <span style="color: \
grey">(343488)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1569/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic