<html 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=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 5 4 2 2 2 2 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p>Dear folks</p><p><o:p> </o:p></p><p>I’m facing a similar name conflict problem when working on NFD face unit testing.</p><p><o:p> </o:p></p><p>I attempted to rename FaceUdp test suite to:</p><p style='margin-left:.5in'><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(Face)<o:p></o:p></span></p><p style='margin-left:.5in'><span style='font-family:Consolas'>BOOST_FIXTURE_TEST_SUITE(TestUdp, ..)<o:p></o:p></span></p><p>and then the name “Face” becomes ambiguous: it refers to not only nfd::Face type, but also the test suite.</p><p><o:p> </o:p></p><p>I feel it’s cumbersome to write “nfd::Face” throughout the test suite.</p><p>But I found a trick that resolve the name conflict problem, without changing the test suite naming convention.</p><p><o:p> </o:p></p><p>The trick is:</p><p style='margin-left:.5in'><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(Face)<o:p></o:p></span></p><p style='margin-left:.5in'><span style='font-family:Consolas'>BOOST_FIXTURE_TEST_SUITE(TestUdp, ..)<o:p></o:p></span></p><p style='margin-left:.5in'><span style='font-family:Consolas'>using nfd::Face;<o:p></o:p></span></p><p>This using directive indicates that “Face” mentioned within the test suite refers to nfd::Face rather than the test suite.</p><p><o:p> </o:p></p><p>Yours, Junxiao</p><p><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p style='border:none;padding:0in'><br><b>From: </b>Yingdi Yu<br><b>Sent: </b>Wednesday, September 16, 2015 11:12<br><b>To: </b>Junxiao Shi<br><b>Cc: </b><br><b>Subject: </b>Re: [Nfd-dev] UnitTesting naming convention: test suite nameconflicts with class name</p></div><p class=MsoNormal><span style='font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>In my latest patch, I went back to </span><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p></div><div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><div><p class=MsoNormal><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(Security)</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(Pib)</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(TestPib)</span><o:p></o:p></p></div></div></div></blockquote><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>and used the full name of the class “security::Pib” in the test cases to avoid name conflict, I think this could be a general solution, because the name of test suite is alway capitalized, but the namespace is not.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p></div><div><div><div><div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black'>Best Regards,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black'>Yingdi <o:p></o:p></span></p></div></div></div></div></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>On Sep 16, 2015, at 7:01 AM, Junxiao Shi <<a href="mailto:shijunxiao@email.arizona.edu">shijunxiao@email.arizona.edu</a>> wrote:<o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><div><div><p class=MsoNormal>Dear folks<o:p></o:p></p><p class=MsoNormal> </p><p class=MsoNormal>Since 20150901 we have adopted a new naming conventions for unit test suites: <a href="http://redmine.named-data.net/projects/nfd/wiki/UnitTesting/6">http://redmine.named-data.net/projects/nfd/wiki/UnitTesting/6</a> </p><p class=MsoNormal>For example, a test suite for ndn::util::Signal should be named: Util/TestSignal.<o:p></o:p></p><p class=MsoNormal> </p><p class=MsoNormal>Under this rule, a test suite for ndn::security::pib::Pib should be named: Security/Pib/TestPib.</p><p class=MsoNormal>In Boost.Test, this is written as:</p><p class=MsoNormal><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(Security)</span></p><p class=MsoNormal><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(Pib)</span></p><p class=MsoNormal><span style='font-family:Consolas'>BOOST_AUTO_TEST_SUITE(TestPib)</span><o:p></o:p></p><p class=MsoNormal> </p><p class=MsoNormal>Each of these BOOST_AUTO_TEST_SUITE macros would declare a class named after the test suite name.</p><p class=MsoNormal>This causes the identifier “Pib” ambiguous: it refers to not only the class under test (ndn::security::pib::Pib), but also the second level test suite.<o:p></o:p></p><p class=MsoNormal> </p><p class=MsoNormal>Yingdi gave two proposals:</p><p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'>1.<span style='font-size:7.0pt;font-family:"Times New Roman",serif'>       </span>name the test suite as Security/PibDir/TestPib</p><p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'>2.<span style='font-size:7.0pt;font-family:"Times New Roman",serif'>       </span>name the test suite as security/pib/TestPib<o:p></o:p></p><p class=MsoNormal> </p><p class=MsoNormal>My proposal is:</p><p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>name the test suite as Security/TestPib/TestPib</p><p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>due to the existence of Pib class, all test suites for ndn::security::pib::* should have its second level named “TestPib” rather than “Pib”<o:p></o:p></p><p class=MsoNormal> </p><p class=MsoNormal>My reason is:</p><p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>Yingdi’s second proposal resolves the name conflict between test suite name and class name, but it creates another conflict: “pib” refers to both the test suite and the namespace ndn::security::pib.</p><p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>Although Yingdi’s first proposal prevents the name conflict, it’s using two different rules to resolve the conflict: (a) append “Dir” (b) prepend “Test”. The purpose for prepending “Test” to the lowest-level test suite name is to resolve the name conflict, so we should reuse the same rule for resolving all conflicts.</p><p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>Having “TestPib” on two levels should be fine, because this class name is never referred to in the testing code.<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> </p><p class=MsoNormal>Yours, Junxiao</p></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>_______________________________________________<br>Nfd-dev mailing list<br><a href="mailto:Nfd-dev@lists.cs.ucla.edu">Nfd-dev@lists.cs.ucla.edu</a><br>http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev<o:p></o:p></span></p></div></blockquote></div></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>