fix: Clean up of code examples in CONTRIBUTING to follow guidelines. (#1063)

This commit is contained in:
Filip Hlasek 2020-08-28 09:47:02 -07:00 committed by GitHub
parent f4fe0c6f5b
commit 4ed75018e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,10 +67,10 @@ namespace name {
/** /**
* Class documentation * Class documentation
*/ */
class cls_name{ class class_name {
private: private:
int var1; ///< short info of this variable int variable; ///< short info of this variable
char *msg; ///< short info char *message; ///< short info
public: public:
// other members also documented as below // other members also documented as below
@ -87,15 +87,16 @@ class cls_name{
template<class T> template<class T>
bool func(int param1, T param2) { bool func(int param1, T param2) {
// function statements here // function statements here
if(/*something bad*/) if (/*something bad*/) {
return false; return false;
}
return true; return true;
} }
/** Test function */ /** Test function */
void test() { static void test() {
/* some statements */ /* desciptions of the following test */
assert(func(...) == ...); // this ensures that the algorithm works as expected assert(func(...) == ...); // this ensures that the algorithm works as expected
// can have multiple checks // can have multiple checks
@ -103,6 +104,7 @@ void test() {
/** Main function */ /** Main function */
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
test(); // execute the tests
// code here // code here
return 0; return 0;
} }