<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1916939931;
        mso-list-template-ids:2059672518;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">First, thanks so much for your willingness to report/research/fix bugs – it’s invaluable.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I don’t know that we’d need to make the full leap to a C Unit testing framework to make use of them on a ticket by ticket basis. If you wanted to roll a simple
 C program that tests just the function in question I’d certainly want to use it. It makes sense in this case. So often though bugs seem to involve a series of functions performing a complex operation where a more complete configuration (e.g. data+mapfile)
 and  request is necessary to trigger the issue.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> mapserver-dev-bounces@lists.osgeo.org [mailto:mapserver-dev-bounces@lists.osgeo.org]
<b>On Behalf Of </b>geographika<br>
<b>Sent:</b> Wednesday, December 03, 2014 8:56 AM<br>
<b>To:</b> mapserver-dev@lists.osgeo.org<br>
<b>Subject:</b> [mapserver-dev] c unit tests in MapServer<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Hi list,<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><br>
With almost 20 years of development, the MapServer codebase can be overwhelming at first. For most open source projects I've found the easiest way into helping with a project is:<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:27.0pt;text-indent:-.25in;mso-list:l0 level1 lfo2;vertical-align:middle">
<![if !supportLists]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Reporting bugs<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:27.0pt;text-indent:-.25in;mso-list:l0 level1 lfo2;vertical-align:middle">
<![if !supportLists]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Finding the problematic code<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:27.0pt;text-indent:-.25in;mso-list:l0 level1 lfo2;vertical-align:middle">
<![if !supportLists]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Submitting a patch and unit test.
<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">In 2006 there was a Request For Comments (#12) by Umberto Nicoletti about adding C Unit tests:
<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Calibri","sans-serif";color:#595959"> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><a href="http://www.mapserver.org/development/rfc/ms-rfc-12.html">http://www.mapserver.org/development/rfc/ms-rfc-12.html</a><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Also see GitHub issue #1664:
<a href="https://github.com/mapserver/mapserver/issues/1664">https://github.com/mapserver/mapserver/issues/1664</a><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Obviously a full test suite of existing code isn't possible, however if the testing framework and skeleton folder/file structure was set up it may
 help more concrete contributions from developers outside of the core MapServer team.
<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">There have been a few bugs I've submitted where I would feel comfortable adding a unit test to an existing file to show the error, but creating full
 msautotest examples seems very daunting. As a concrete example while testing the latest dev build I noticed the msParseTime function in the maptime.c module threw an error. Unit tests for this function seem like the perfect solution for these types of bugs,
 and to avoid breaking changes in the future. <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><a href="https://github.com/mapserver/mapserver/commit/0cc47e3027a75cf18c5310694877999c6b245371">https://github.com/mapserver/mapserver/commit/0cc47e3027a75cf18c5310694877999c6b245371</a><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">C Unit tests have come up a few times in the past e.g. Paul Ramsey's post about PostGIS driver testing:
<a href="http://osgeo-org.1560.x6.nabble.com/cunit-RFC-12-td4261340.html">http://osgeo-org.1560.x6.nabble.com/cunit-RFC-12-td4261340.html</a><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Frank Warmerdam's response (in 2008) was -
<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">My preference remains to test specific functions as part of a larger </span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">operations since we already have such technology in place (ie. msautotest) </span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">or to expose the functionality through mapscript and use mapscript tests </span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">like Sean's python unit tests. </span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">I do not feel that introducing another testing methodology into the </span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">project would be wise. </span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">The Python unit tests are again useful, but require testing against full builds, a difficult task for those not familiar with make files and gathering
 dependencies. <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Testing database drivers as I understand it would require a full test database setup with msautotest, whereas for many bugs it is clear which function
 needs modifying and a unit test could be added quickly to highlight and help fix the bug.
<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">I've only experience in Python and .NET unit testing so perhaps C testing is more trouble than it is worth.
<br>
I guess it is up to the core devs whether it has any benefit to themselves, or the project as a whole, whether this issue should be reconsidered.
<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Regards,<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Seth<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#888888">--<br>
web:</span><a href="http://geographika.co.uk"><span style="color:#888888"> </span>
http://geographika.co.uk</a><br>
<span style="color:#888888">twitter: @geographika</span><o:p></o:p></p>
</div>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
</div>
</body>
</html>