[asterisk-dev] [Code Review] Unit Test Framework

Mark Michelson mmichelson at digium.com
Wed Dec 16 13:01:50 CST 2009



> On 2009-12-16 11:33:07, Russell Bryant wrote:
> > /trunk/main/test.c, lines 427-450
> > <https://reviewboard.asterisk.org/r/447/diff/1/?file=7562#file7562line427>
> >
> >     This will return true for cat2 "/channels/sip" and cat1 "/channels/sippppppppppppppppppppppp/OMGZOMBIES/pancake"
> >     
> >     Is this intentional?
> 
> Mark Michelson wrote:
>     The comment makes me think it is, though maybe not to the extreme you have it.
>     
>     I think the idea is to tell if cat1 is the same as or a subcategory of cat2. So for instance, this would return true for the following:
>     
>     cat1 = /channels/sip/foo, cat2 = /channels/sip/bar
>     cat1 = /channels, cat2 = /channels
>     cat1 = /channels, cat2 = /channels/that/go/bump/in/the/night
>     
>     However, you raise a good point that something like
>     cat1 = /channels/sip should not match cat2 = /channels/sipsucks

OMG I totally messed that comment up and wish I could delete it. Let me try again:

I think the idea is to tell if cat1 is the same as or a subcategory of cat2. So for instance, this would return true for the following:

cat1 = /channels/sip/foo/bar, cat2 = /channels/sip/foo/
cat1 = /channels, cat2 = /channels
cat1 = /channels/that/go/bump/in/the/night, cat2 = /channels/

However, you raise a good point that something like
cat1 = /channels/sipsucks should not match cat2 = /channels/sip


- Mark


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


On 2009-12-15 18:15:17, David Vossel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/447/
> -----------------------------------------------------------
> 
> (Updated 2009-12-15 18:15:17)
> 
> 
> Review request for Asterisk Developers and Russell Bryant.
> 
> 
> Summary
> -------
> 
> The Unit Test Framework is a new API that manages registration and execution of unit tests in Asterisk with the purpose of verifying the operation of C functions.
> 
> The Framework consists of a single test manager accompanied by a list of registered test functions defined within the code.  A test is defined, registered, and unregistered from the framework using a set of macros which allow the test code to only be compiled within asterisk when the TEST_FRAMEWORK flag is enabled in menuselect.  This allows the test code to exist in the same file as the C functions it intends to verify.  Registered tests may be viewed and executed via a set of new CLI commands.  CLI commands are also present for generating and exporting test results into xml and txt formats.
> 
> For more information and use cases please refer to the documentation provided at the beginning of the test.h file.
> 
> 
> Diffs
> -----
> 
>   /trunk/build_tools/cflags-devmode.xml 235225 
>   /trunk/include/asterisk/test.h PRE-CREATION 
>   /trunk/main/asterisk.c 235225 
>   /trunk/main/test.c PRE-CREATION 
>   /trunk/tests/test_heap.c 235225 
> 
> Diff: https://reviewboard.asterisk.org/r/447/diff
> 
> 
> Testing
> -------
> 
> test_heap.c has been modified to take advantage of the Test Framework.  I have executed and generated reports for these tests. 
> 
> 
> Thanks,
> 
> David
> 
>




More information about the asterisk-dev mailing list