I would recommend using _test.cc, and then just prevent any other class from 
being named as _test.cc.

This is also the recommendation of the Google C++ style guide: 
https://google.github.io/styleguide/cppguide.html#File_Names

Conceptually, it feels nice as we don't change the simple .cc style we have 
right now of [a-z_]*.cc for all files, although I can't see any major breakages 
besides linters complaining.

________________________________
From: gem5-dev <[email protected]> on behalf of Gabe Black 
<[email protected]>
Sent: Thursday, November 29, 2018 12:54:21 AM
To: gem5 Developer List
Subject: [gem5-dev] Unit test naming convention

Hi folks. We have a few unit tests now, and they are mostly consistently
named by adding test to the file name. For instance the tests for foo.cc
would be in footest.cc.

There are two minor downsides to that. First, that's a bit ugly to read,
and it may look weird if files, for instance, use _ to separate words
instead of squishing everything together, ie foo_bar.cc -> foo_bartest.cc.
Second, if there already is a footest.cc which is not for unit tests (not
super likely, but definitely possible), then the naming gets a little
ambiguous.

Would it make sense to mark tests with .test, so foo.cc -> foo.test.cc?
That's clear to read, more universally consistent, easily grepped for, and
will probably not be ambiguous.

Gabe
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to