<commit_before>cpp_unit_test
=============

Quick and simple Unit Testing Module designed for
Object Oriented Programming written in C++

*****************************************************************
Definitions

     group :  groups using namespace multiple test suites together
              and a pool of sample tests used by the test suites

     suite :  each test suite runs a sequence of sample tests

     run:     RUN method in suite object runs the pushed tests

              RUN_UNIT<_<option>>(<namespace>,<suiteclass>,<name>) macro will run the tests

	          RUN_UNIT:        the user is responsible for I/O buffer redirection
                               the user can freely choose how to redirect input/output buffers

              RUN_UNIT_PAIRED: the funtion takes care of file I/O buffer redirection
                               read from one input file under the test directory

     test  :  a sample test to be run

     check :  checks output file with the reference file

              RUN_UNIT:        user defined number of checks per test (0 or more)
                               the user is responsible for checking outputs & errors
                               the user is responsible for saving the passes/fails
              RUN_UNIT_PAIRED: one final I/O check per test (one-to-one pairing)
                               the function checks final outputs and errors
                               the function takes care of updating passes/fails


*****************************************************************

Designing the test suite (paired testing)
-----------------------------------------------------------------
Create test subdirectories <test_1>,<test_2>,.. under the directory containing
executable file. Create test files:
        test1/test1.in (input)
        test1/test1.out (output)
        test1/test1.ref (reference for output)
        test1/test1.err (error)
        test1/test1.erf (error reference)
-----------------------------------------------------------------
Group Level (add.h)

    namespace AddUnitTesting {

        // generic test algorithm
        VOID add_test();

        // Create a function "test1" corresponding to test files
        // test1/test1.in (input)
        // test1/test1.out (output)
        // test1/test1.ref (reference for output)
        // test1/test1.err (error)
        // test1/test1.erf (error reference)

        VOID test1();
        // ...

        class TestingSuite: IS_UNITTEST {
        public:
            TestingSuite();
        };
    }

-----------------------------------------------------------------
Suite Level

    AddUnitTesting::TestingSuite::TestingSuite() : UnitTestSuite() {
        PUSH(test1);
        //...
    }

-----------------------------------------------------------------
Test Level

    VOID test1() {
        int x, y;
        while (cin >> x >> y)
            cout << add(x, y) << endl;
    }


*****************************************************************

Designing the test suite (User-defined/unpaired testing)
-----------------------------------------------------------------
Suppose that one wishes to test an algorithm that controls movements of a robot.
-----------------------------------------------------------------
Group level (robot_test.h)

    #include <unittest.h>                   // add path to compiler unit test directory

    namespace robot {                       // robot namespace contains all tests/suites
        VOID talk();                        // test case that involves talking
        VOID move_left();                   // test case that involves moving left
        VOID move_right();                  // test case that involves moving right
        VOID move_up();                     // test case that involves moving up
        VOID move_down();                   // test case that involves moving down

        class RobotMovements: IS_UNITTEST {
            public:
            RobotMovements();               // push all relevant test cases into contructor
        };<commit_msg>Readme text<commit_after>cpp_unit_test
=============

Quick and simple Unit Testing Module designed for
Object Oriented Programming written in C++

*****************************************************************
Definitions

     group :  groups using namespace multiple test suites together
              and a pool of sample tests used by the test suites

     suite :  each test suite runs a sequence of sample tests

     run:     RUN method in suite object runs the pushed tests

              RUN_UNIT<_<option>>(<namespace>,<suiteclass>,<name>) macro will run the tests

	          RUN_UNIT:        the user is responsible for I/O buffer redirection
                               the user can freely choose how to redirect input/output buffers

              RUN_UNIT_PAIRED: the funtion takes care of file I/O buffer redirection
                               read from one input file under the test directory

     test  :  a sample test to be run

     check :  checks output file with the reference file

              RUN_UNIT:        user defined number of checks per test (0 or more)
                               the user is responsible for checking outputs & errors
                               the user is responsible for saving the passes/fails
              RUN_UNIT_PAIRED: one final I/O check per test (one-to-one pairing)
                               the function checks final outputs and errors
                               the function takes care of updating passes/fails


*****************************************************************

Designing the test suite (paired testing)
-----------------------------------------------------------------
Create test subdirectories <test_1>,<test_2>,.. under the directory containing
executable file. Create test files:
        test1/test1.in (input)
        test1/test1.out (output)
        test1/test1.ref (reference for output)
        test1/test1.err (error)
        test1/test1.erf (error reference)

-----------------------------------------------------------------
Group Level (add.h)

    namespace AddUnitTesting {

        // generic test algorithm
        VOID add_test();

        // Create a function "test1" corresponding to test files
        // test1/test1.in (input)
        // test1/test1.out (output)
        // test1/test1.ref (reference for output)
        // test1/test1.err (error)
        // test1/test1.erf (error reference)

        VOID test1();
        // ...

        class TestingSuite: IS_UNITTEST {
        public:
            TestingSuite();
        };
    }

-----------------------------------------------------------------
Suite Level

    AddUnitTesting::TestingSuite::TestingSuite() : UnitTestSuite() {
        PUSH(test1);
        //...
    }

-----------------------------------------------------------------
Test Level

    VOID test1() {
        int x, y;
        while (cin >> x >> y)
            cout << add(x, y) << endl;
    }


*****************************************************************

Designing the test suite (User-defined/unpaired testing)
-----------------------------------------------------------------
Suppose that one wishes to test an algorithm that controls movements of a robot.

-----------------------------------------------------------------
Group level (robot_test.h)

    #include <unittest.h>                   // add path to compiler unit test directory

    namespace robot {                       // robot namespace contains all tests/suites
        VOID talk();                        // test case that involves talking
        VOID move_left();                   // test case that involves moving left
        VOID move_right();                  // test case that involves moving right
        VOID move_up();                     // test case that involves moving up
        VOID move_down();                   // test case that involves moving down

        class RobotMovements: IS_UNITTEST {
            public:
            RobotMovements();               // push all relevant test cases into contructor
        };
{'fraction_non_alphanumeric': 0.20201276386843398, 'fraction_numerical': 0.0066273932253313695, 'mean_word_length': 1.4427458033573142, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6282585', 'n_tokens_mistral': 1841, 'n_tokens_neox': 1702, 'n_words': 689}