Studio:Test Unit Template: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
 
m (Text replace - 'Category:Documentation' to 'Category:Studio:Documentation')
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Following is an example of NaturalDocs commenting on a test class. It should be used as a template for such commenting.


[[Category:Project Documentation]]
Please put NaturalDocs comments in .h files.
[[Category:Practice]]
 
<source lang="cpp">
#pragma once
#include <srtest.h>
 
namespace Basic {
    /*
    Class: Constructors
    Demonstrates passing constructor arguments to a test unit
    */
    class Constructors {
    public:
        /*
        Constructor: Constructors
        Constructor that sets internal values
 
        Parameters:
            val_1 - first argument
            val_2 - second argument
        */
        Constructors(int val_1, int val_2);
        /*
        Function: TestValuePositive
 
        Tests whether both values passed to the constructor are positive (e.g. greater than zero)
 
        Returns:
            true if both values are positive, false otherwise
        */
        bool TestValuesPositive();
        /*
        Enum: CounterMode
        Example enumeration
 
        NORMAL - Causes the counter to increment normally.
        ODD    - Causes the counter to only increment in odd numbers.
        EVEN  - Causes the counter to only increment in even numbers.
        */
        enum Mode { NORMAL, ODD, EVEN };
 
        // Constant: szLINK_TO_TEST_SPEC
        // wiki link that gets put into the test suite description
        static const char* szLINK_TO_TEST_SPEC;
    private:
        int value_1;
        int value_2;
    };
}
 
#ifdef _SCL
#pragma scl_test_class(Basic::Constructors)
#endif
 
</source>
 
[[Category:Studio:Documentation]]

Latest revision as of 22:42, 20 August 2009

Following is an example of NaturalDocs commenting on a test class. It should be used as a template for such commenting.

Please put NaturalDocs comments in .h files.

#pragma once
#include <srtest.h>

namespace Basic {
    /*
    Class: Constructors
    Demonstrates passing constructor arguments to a test unit
    */
    class Constructors {
    public:
        /*
        Constructor: Constructors
        Constructor that sets internal values

        Parameters:
            val_1 - first argument
            val_2 - second argument
        */
        Constructors(int val_1, int val_2);
        /*
        Function: TestValuePositive

        Tests whether both values passed to the constructor are positive (e.g. greater than zero)

        Returns:
            true if both values are positive, false otherwise
        */
        bool TestValuesPositive();
        /*
        Enum: CounterMode
        Example enumeration

        NORMAL - Causes the counter to increment normally.
        ODD    - Causes the counter to only increment in odd numbers.
        EVEN   - Causes the counter to only increment in even numbers.
        */
        enum Mode { NORMAL, ODD, EVEN };

        // Constant: szLINK_TO_TEST_SPEC
        // wiki link that gets put into the test suite description
        static const char* szLINK_TO_TEST_SPEC;
    private:
        int value_1;
        int value_2;
    };
}

#ifdef _SCL
#pragma scl_test_class(Basic::Constructors)
#endif