[Nfd-dev] UnitTesting naming convention: test suite nameconflicts with class name

Junxiao Shi shijunxiao at email.arizona.edu
Wed Sep 16 08:12:26 PDT 2015


Dear folks

I disagree with applying rule 2.6 to this case. It would create a third convention that is inconsistent with the first two.
20150901 conference call decides that any new unit test naming convention is required on new test suites only, which means the inconsistency will be there forever.

My proposal below is an extension of the current convention.
Any test suite that conforms to the current convention also conforms to my proposal, which ensures only two conventions exist. 

Yours, Junxiao


From: Davide Pesavento
Sent: Wednesday, September 16, 2015 08:04
To: Junxiao Shi
Cc: 
Subject: Re: [Nfd-dev] UnitTesting naming convention: test suite nameconflicts with class name


If I remember correctly BOOST_AUTO_TEST_SUITE declares a namespace,
not a class. According to rule 2.6, namespace names should start with
a lowercase letter. In any case, we should avoid name clashes even
between classes and namespaces.




From: Junxiao Shi
Sent: Wednesday, September 16, 2015 07:01
To: 
Subject: UnitTesting naming convention: test suite name conflicts with classname


Dear folks

Since 20150901 we have adopted a new naming conventions for unit test suites: http://redmine.named-data.net/projects/nfd/wiki/UnitTesting/6 
For example, a test suite for ndn::util::Signal should be named: Util/TestSignal.

Under this rule, a test suite for ndn::security::pib::Pib should be named: Security/Pib/TestPib.
In Boost.Test, this is written as:
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Pib)
BOOST_AUTO_TEST_SUITE(TestPib)

Each of these BOOST_AUTO_TEST_SUITE macros would declare a class named after the test suite name.
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.

Yingdi gave two proposals:
1.       name the test suite as Security/PibDir/TestPib
2.       name the test suite as security/pib/TestPib

My proposal is:
•         name the test suite as Security/TestPib/TestPib
•         due to the existence of Pib class, all test suites for ndn::security::pib::* should have its second level named “TestPib” rather than “Pib”

My reason is:
•         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.
•         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.
•         Having “TestPib” on two levels should be fine, because this class name is never referred to in the testing code.


Yours, Junxiao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20150916/e9defde2/attachment.html>


More information about the Nfd-dev mailing list