TZTester

TZTester is a CodeProcessor plug-in that automatically extracts the examples test cases given in the problem description and generates C++ code that runs the test cases. Programmers no longer need to manually type in the test cases in the test dialog box. The plug-in is designed to work with either PopsEdit or FileEdit. If you use other editors, you may need to adapt accordingly.

My TopCoder handle is "TangentZ".


Installation

    0. Download CodeProcessor 1.2 (or higher) if not already
    1. Follow the installation instructions of CodeProcessor
    2. Add TZTester.jar (the location of the JAR) to the ClassPath
    3. Use "popsedit.EntryPoint" or "fileedit.EntryPoint" (or another editor that you use) as the Editor
    4. Use "tangentz.TZTester" as CodeProcessor name
    5. Restart the Contest Arena applet
    6. Click on "Verify" to make sure all 3 methods are found
    7. Configure your editor template (See Template Examples)
    8. Go to any practice room and open a problem to make sure everything is in place
    9. Happy coding!
    


Template Examples

TZTester defines two internal tags to determine where to put the generated code.

If you use PopsEdit, you may use this template:

    class $CLASSNAME$
        {
        public:
        $RC$ $METHODNAME$($METHODPARMS$)
            {
            $RUNTEST$
            $CARETPOSITION$
            }
        // end of $METHODNAME$

        $TESTCODE$
        };
    // end of $CLASSNAME$
    

If you use FileEdit, you may use this template instead (thanks to pewloo):

    class $CLASSNAME$
        { 
        public: 
        $RC$ $METHODNAME$($METHODPARMS$) 
            { 
            $CARETPOSITION$ 
            } 
        $TESTCODE$ 
        }; 

    // BEGIN CUT HERE 
    int main()
        {
        $CLASSNAME$ ___test; 
        ___test.run_test(-1); 
        } 
    // END CUT HERE 
    

Notice that run_test() is called directly in main() and there is no need for the $RUNTEST$ tag.


Usage

TZTester generates one public member function and several private member functions for testing purposes.

Keep in mind that all test cases are run from within the function that system tester uses. A local static variable is used to prevent infinite recursion (if using PopsEdit). If you find that all test cases cannot run within the 8 second time limit, you may want to run each test individually by changing the argument to run_test().

Also, TZTester does no do any "code cutting". You probably want to manually cut out the test code before submitting to the Contest Applet. Note that if TZTester did any "code cutting", then the Contest Applet will never see the test code, rendering it useless to PopsEdit users.


History

    [Version 1.01 - 25 Feb 2003]

    - Made run_test() a public member function (suggestion from pewloo)
    - Changed to use FileEdit cut tags

    [Version 1.00 - 18 Feb 2003]

    - Initial Version
    - Tested with PopsEdit and problems from SRM 120+