From: <bi...@us...> - 2013-12-23 12:36:17
|
Revision: 9752 http://sourceforge.net/p/oorexx/code-0/9752 Author: bigrixx Date: 2013-12-23 12:36:12 +0000 (Mon, 23 Dec 2013) Log Message: ----------- Add some tests for RexxRegisterFunctionExe Modified Paths: -------------- test/trunk/external/API/orxclassic.cpp test/trunk/ooRexx/API/classic/CLASSIC.testGroup test/trunk/ooRexx/API/classic/CLASSICPackage.cls Modified: test/trunk/external/API/orxclassic.cpp =================================================================== --- test/trunk/external/API/orxclassic.cpp 2013-12-22 19:49:39 UTC (rev 9751) +++ test/trunk/external/API/orxclassic.cpp 2013-12-23 12:36:12 UTC (rev 9752) @@ -40,6 +40,27 @@ #include <string.h> #include <stdio.h> +// test function for testing the function registration functions +size_t REXXENTRY TestFunction( + const char *Name, + size_t Argc, /* number of arguments */ + CONSTRXSTRING Argv[], /* list of argument strings */ + const char *Queuename, /* current queue name */ + PRXSTRING Retstr) /* returned */ +{ + // if registered as an error tester, raise an error + if (strcmp(Name, "TESTERROR") == 0) { + return 40; + } + + // return the name, count of arguments, and first argument as a return value + sprintf(Retstr->strptr, "%s %d %s", Name, Argc, Argv[0].strptr); + Retstr->strlength = strlen(Retstr->strptr); + return 0; +} + + + RexxMethod1(RexxObjectPtr, // Return type TestCreateQueue, // Method name OPTIONAL_CSTRING, qname) // Queue name @@ -394,7 +415,31 @@ return retc; } +RexxMethod1(int, // Return type + TestRegisterFunctionExe, // Method name + CSTRING, name) // function name +{ + RexxReturnCode retc = RexxRegisterFunctionExe(name, (REXXPFN)TestFunction); + return retc; +} +RexxMethod1(int, // Return type + TestDeregisterFunction, // Method name + CSTRING, name) // function name +{ + RexxReturnCode retc = RexxDeregisterFunction(name); + return retc; +} + +RexxMethod1(int, // Return type + TestQueryFunction, // Method name + CSTRING, name) // function name +{ + RexxReturnCode retc = RexxQueryFunction(name); + return retc; +} + + RexxMethodEntry orxtest_methods[] = { REXX_METHOD(TestCreateQueue, TestCreateQueue), REXX_METHOD(TestOpenQueue, TestOpenQueue), @@ -413,6 +458,9 @@ REXX_METHOD(TestQueryMacro, TestQueryMacro), REXX_METHOD(TestReorderMacro, TestReorderMacro), REXX_METHOD(TestClearMacroSpace, TestClearMacroSpace), + REXX_METHOD(TestRegisterFunctionExe,TestRegisterFunctionExe), + REXX_METHOD(TestDeregisterFunction, TestDeregisterFunction), + REXX_METHOD(TestQueryFunction, TestQueryFunction), REXX_LAST_METHOD() }; Modified: test/trunk/ooRexx/API/classic/CLASSIC.testGroup =================================================================== --- test/trunk/ooRexx/API/classic/CLASSIC.testGroup 2013-12-22 19:49:39 UTC (rev 9751) +++ test/trunk/ooRexx/API/classic/CLASSIC.testGroup 2013-12-23 12:36:12 UTC (rev 9752) @@ -960,6 +960,16 @@ retc = t2~TestQueryMacro('myupper') self~assertEquals(2, retc) +::method 'test_77_function' + t2 = .TestFunctionRegistration~new + self~assertEquals(0, t2~TestRegisterFunctionExe("MYFUNCTION")) + self~assertEquals(0, t2~TestQueryFunction("MYFUNCTION")) + + self~assertEquals("MYFUNCTION 1 Hello World!", myfunction("Hello World!")) + self~assertEquals(0, t2~TestDeregisterFunction("MYFUNCTION")) + self~assertEquals(30, t2~TestQueryFunction("MYFUNCTION")) + + ::method locateTestFile use arg file parse source . . me Modified: test/trunk/ooRexx/API/classic/CLASSICPackage.cls =================================================================== --- test/trunk/ooRexx/API/classic/CLASSICPackage.cls 2013-12-22 19:49:39 UTC (rev 9751) +++ test/trunk/ooRexx/API/classic/CLASSICPackage.cls 2013-12-23 12:36:12 UTC (rev 9752) @@ -86,3 +86,7 @@ ::method TestReorderMacro PUBLIC EXTERNAL "LIBRARY orxclassic TestReorderMacro" ::method TestClearMacroSpace PUBLIC EXTERNAL "LIBRARY orxclassic TestClearMacroSpace" +::class TestFunctionRegistration public +::method TestRegisterFunctionExe PUBLIC EXTERNAL "LIBRARY orxclassic TestRegisterFunctionExe" +::method TestDeregisterFunction PUBLIC EXTERNAL "LIBRARY orxclassic TestDeregisterFunction" +::method TestQueryFunction PUBLIC EXTERNAL "LIBRARY orxclassic TestQueryFunction" |