[asterisk-dev] [Code Review] 3923: CallerID: Fix parsing of malformed callerid strings

opticron reviewboard at asterisk.org
Thu Aug 21 14:01:20 CDT 2014



> On Aug. 19, 2014, 1:05 p.m., rmudgett wrote:
> > branches/1.8/tests/test_callerid.c, line 608
> > <https://reviewboard.asterisk.org/r/3923/diff/1/?file=66615#file66615line608>
> >
> >     Rather than a bunch of redundant tests checking minor variations in the string.  How about one test that works through an array of input string variatons and the expected broken out strings:
> >     struct expect {
> >       char *orig;
> >       char *name;
> >       char *number;
> >     };
> >     struct expect array[] = {
> >       { "name <number>", "name", "number" },
> >       { "\"name\" <number>", "name", "number" },
> >       { "name", "name", NULL },
> >       { "1234", NULL, "1234" }
> >     }
> >     
> >     The last two entries above are also valid possibilities for the input string to ast_callerid_parse().
> 
> Mark Michelson wrote:
>     Hm, I see that this has a check mark as being resolved, so I may be wasting my breath here. I want to weigh in and say that I like the idea of having separate tests rather than a single one. That way, if there is a regression, it's eaiser to see that cases A, B, F, and H pass while cases C, D, E, and G fail. They're redundant, yes, and it may be possible to factor out some test logic into common functions, but having them as separate tests is a positive thing if you ask me.
>     
>     If you've already combined these into a single test, though, then nevermind, just leave it like it is.

I've combined them into nominal and off-nominal tests.


- opticron


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


On Aug. 18, 2014, 8:55 p.m., opticron wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3923/
> -----------------------------------------------------------
> 
> (Updated Aug. 18, 2014, 8:55 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This allows the callerid parsing function to handle malformed input strings and strings containing escaped and unescaped double quotes. This also adds a unittest to cover many of the cases where the parsing algorithm previously failed.
> 
> 
> Diffs
> -----
> 
>   branches/1.8/tests/test_callerid.c PRE-CREATION 
>   branches/1.8/res/res_agi.c 421326 
>   branches/1.8/main/privacy.c 421326 
>   branches/1.8/main/manager.c 421326 
>   branches/1.8/main/callerid.c 421326 
>   branches/1.8/include/asterisk/callerid.h 421326 
>   branches/1.8/channels/chan_unistim.c 421326 
>   branches/1.8/channels/chan_misdn.c 421326 
>   branches/1.8/apps/app_voicemail.c 421326 
>   branches/1.8/apps/app_dial.c 421326 
> 
> Diff: https://reviewboard.asterisk.org/r/3923/diff/
> 
> 
> Testing
> -------
> 
> Ran the unittest.
> 
> 
> Thanks,
> 
> opticron
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140821/9181c38d/attachment.html>


More information about the asterisk-dev mailing list