code34 248 Posted January 11, 2018 OO UNITTEST Lastest version: 0.2 by Code34 Description OO UNITTEST is a class (object oriented) that permits to do unit test with OOP.h object code. Unit tests make the code more reliable and automatically run tests to check that all the functions of a program work as expected. This is a first version, it is not optimized but can lay the foundation to start doing things. Github: https://github.com/code34/oo_unittest.vr Reference: http://forums.bistudio.com/showthread.php?167980-Object-Oriented-SQF-Scripting-and-Compiling Features: - 2 set of methods to check method results: assert_equal & assert_not_equal - check time of execution for each methods / types - Dump into clipboard a global results Licence: Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author Code Exemple /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2018 Nicolas BOITEUX CLASS OO_UNITTEST This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "oop.h" call compile preprocessFileLineNumbers "oo_unittest.sqf"; call compile preprocessFileLineNumbers "oo_helloworld.sqf"; sleep 2; _unittest = "new" call OO_UNITTEST; _helloworld = "new" call OO_HELLOWORLD; // should succeed cause return the good result _result = ["assert_equal", [_helloworld, "helloworld", "i got it", nil]] call _unittest; //shoud failed cause return the result not expected _result = ["assert_not_equal", [_helloworld, "helloworld", "i got it", nil]] call _unittest; //should failed cause method doesn't exist _result = ["assert_equal", [_helloworld, "hellowor", "i got it", nil]] call _unittest; //should passed cause object nil doesn't exist (arma will print an error message) _result = ["assert_equal", [nil, "helloworld", "i got it", nil]] call _unittest; "dump" call _unittest; Results of Dump ==> Function: helloworld Condition: assert_equal Params: None Return expected: STRING (i got it) Return: STRING (i got it) Time: 0 ms Result: SUCCESSED Error Message: None <== ==> Function: helloworld Condition: assert_not_equal Params: None Return expected: STRING (i got it) Return: STRING (i got it) Time: 0 ms Result: FAILED Error Message: Result is not the one expected <== ==> Function: hellowor Condition: assert_equal Params: None Return expected: STRING (i got it) Return: ARRAY (["ERROR UNDEF : OO_HELLOWORLD(""STRING"",""hellowor"")"]) Time: 0.000976563 ms Result: FAILED Error Message: Result is not the one expected <== ==> Function: helloworld Condition: assert_equal Params: None Return expected: STRING (i got it) Return: (any) Time: 0 ms Result: PASSED Error Message: Object is not define <== Global Results: ============ Successed: 1 Passed: 1 Failed: 2 Share this post Link to post Share on other sites
code34 248 Posted January 13, 2018 Hi Working currently, on the next version. I believe i will unsupport the procedural code, except if anyone have the usage of it. Most of the code was develop for oo way, it will be more clear and easiest to support. Share this post Link to post Share on other sites
Guest Posted January 24, 2018 An Armaholic mirror is now available: OO UNITTEST v0.1 ** better late than never ;) Share this post Link to post Share on other sites
code34 248 Posted January 24, 2018 thanks you @foxhound next one will be better ! Share this post Link to post Share on other sites
code34 248 Posted February 11, 2018 Hi :) Just release the version 0.2 : - delete useless procedural support - fix code relative to nil return - add more informations in dump report Share this post Link to post Share on other sites