aboutsummaryrefslogtreecommitdiff
path: root/src/unittest
Commit message (Collapse)AuthorAge
* Add ModStorageAPI to client side modding (#5396)Loïc Blot2017-03-16
| | | mod storage is located into user_path / client / mod_storage
* [CSM] Client side moddingLoic Blot2017-03-13
| | | | | | | | | | * rename GameScripting to ServerScripting * Make getBuiltinLuaPath static serverside * Add on_shutdown callback * Add on_receiving_chat_message & on_sending_chat_message callbacks * ScriptApiBase: use IGameDef instead of Server This permits to share common attribute between client & server * Enable mod security in client side modding without conditions
* Fix synchronization issue at thread startShadowNinja2017-01-28
| | | | | | | | | | | | | | | | If a newly spawned thread called getThreadId or getThreadHandle before the spawning thread finished saving the thread handle, then the handle/id would be used uninitialized. This would cause the threading tests to fail since isCurrentThread would return false, and if Minetest is built with C++11 support the std::thread object pointer would be dereferenced while ininitialized, causing a segmentation fault. This fixes the issue by using a mutex to force the spawned thread to wait for the spawning thread to finish initializing the thread object. An alternative way to handle this would be to also set the thread handle/id in the started thread but this wouldn't work for C++11 builds because there's no way to get the partially constructed object.
* Revert "Extend minetest.is_yes()"sfan52017-01-07
| | | | This reverts commit c435eabf3ffb77eab955d5faeb5450da1befc149.
* Extend minetest.is_yes()red-0012017-01-07
|
* Improve getPointedThing() (#4346)Dániel Juhász2017-01-04
| | | | | | | | | | | | | | | | | | | * Improved getPointedThing() The new algorithm checks every node exactly once. Now the point and normal vector of the collision is also returned in the PointedThing (currently they are not used outside of the function). Now the CNodeDefManager keeps the union of all possible nodeboxes, so the raycast won't miss any nodes. Also if there are only small nodeboxes, getPointedThing() is exceptionally fast. Also adds unit test for VoxelLineIterator. * Cleanup, code move This commit moves getPointedThing() and Client::getSelectedActiveObject() to ClientEnvironment. The map nodes now can decide which neighbors they are connecting to (MapNode::getNeighbors()).
* Breath cheat fix: server sideLoic Blot2017-01-01
| | | | | | | | | Breath is now handled server side. Changing this behaviour required some modifications to core: * Ignore TOSERVER_BREATH package, marking it as obsolete * Clients doesn't send the breath to server anymore * Use PlayerSAO pointer instead of peer_id in Server::SendPlayerBreath to prevent a useless lookup (little perf gain) * drop a useless static_cast in emergePlayer
* Fix RemoveRelatvePathComponentsShadowNinja2016-12-20
| | | | | This used to return "/foo" for "../foo" when it should return the enpty string (i.e., error removing all relative components).
* Fix filepath > RemoveRelativePathComponent unittestsfan52016-11-27
| | | | (was broken by e4ee6548afd01040046ee3780d0fbb121d141251)
* Fix overloading problems mentioned by clangLoic Blot2016-10-30
|
* PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul2016-10-30
| | | | | | | | | | | | | | | | | * Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO * Move breath to PlayerSAO & LocalPlayer * Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO * Migrate m_yaw from Player to LocalPlayer for client * Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it * Move pitch to LocalPlayer & PlayerSAO * Move m_position from Player to LocalPlayer * Move camera_barely_in_ceiling to LocalPlayer as it's used only there * use PlayerSAO::m_base_position for Server side positions * remove a unused variable * ServerActiveObject::setPos now uses const ref * use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded * Move hp from Player to LocalPlayer * Move m_hp from LuaEntitySAO to UnitSAO * Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
* Add unittests to test player saving/loading (#4679)Ner'zhul2016-10-27
|
* Travis: build matrix improvements + CPP11 buildLoic Blot2016-10-06
|
* Only include keycode unittests in client build (fixes #4559)sfan52016-09-29
|
* Add keycode.cpp unittestssfan52016-09-25
|
* couple of memory leaks fixes.David Carlier2016-08-10
|
* Mapgen: Remove unused 'flat' and 'trees' flags from mg_flagsparamat2016-08-04
| | | | | | | | | | | | | | | | When the 'flat' and 'trees' flags were moved into mgv6_spflags they were left in mg_flags in an attempt to support old mgv6 worlds. However their appearence in mg_flags causes confusion, also, later, old-world support was found to be broken for mgv6 worlds with 'notrees'. This commit cleans up the mess and comes a month after a thread warning of the change, and explaining the required action, was posted in the news subforum. Only old mgv6 worlds with 'flat' or 'notrees' are affected, a small minority of worlds, the required action being correctly setting these flags in mgv6_spflags. Disable a section of the 'map settings manager' unit test which is to be changed as it is causing problems for pull requests.
* test_map_settings_manager: Fix Wunused-result warningest312016-08-04
|
* Temporarily disable "testStartStopWait" Threading unit test on macest312016-07-04
| | | | | | | | | | | The "testStartStopWait" unit test is unreliably failing on mac, for some time already. See bug #3786. Having the unittest fail unreliably doesn't help anybody but mostly inhibits the main feature of travis builds: to test PRs for regressions. Therefore, disable the specific unit test for until bug #3786 is fixed.
* Add MapSettingsManager and new mapgen setting script API functionskwolekr2016-07-03
| | | | | | | | | | | | | | | This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed.
* Escape more strings: formspecs, item descriptions, infotexts...Ekdohibs2016-04-24
| | | | | | Also, change the escape character to the more standard \x1b Thus, it can be used in the future for translation or colored text, for example.
* Implement AreaStore serializationShadowNinja2016-03-07
|
* Move AreaStore to utilShadowNinja2016-03-07
|
* Simplify AreaStore ID managementShadowNinja2016-03-07
|
* Don't pass non-const references to collision methodsest312016-01-29
| | | | | Non const references cause a lot of confusion with behaviour of code, and are disallowed by minetest style guide.
* Add server side ncurses terminalest312015-11-06
| | | | | | | | | | | | | | | | | | | | | | | | This adds a chat console the server owner can use for administration or to talk with players. It runs in its own thread, which makes the user interface immune to the server's lag, behaving just like a client, except timeout. As it uses the same console code as the f10 console, things like nick completion or a scroll buffer basically come for free. The terminal itself is written in a general way so that adding a client version later on is just about implementing an interface. Fatal errors are printed after the console exists and the ncurses terminal buffer gets cleaned up with endwin(), so that the error still remains visible. The server owner can chose their username their entered text will have in chat and where players can send PMs to. Once the username is secured with a password to prevent anybody to take over the server, the owner can execute admin tasks over the console. This change includes a contribution by @kahrl who has improved ncurses library detection.
* Remove some abort() callsest312015-10-26
| | | | abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
* Fix some threading things and add additional thread unittestskwolekr2015-10-24
| | | | | | - Fix thread name reset on start() - Fully reset thread state on kill() - Add unittests to check for correct object states under various circumstances
* Add BufReader and vector-based serialization methodskwolekr2015-10-15
|
* Rename macros with two leading underscoresShadowNinja2015-10-14
| | | | These names are reserved for the compiler/library implementations.
* Refactor loggingShadowNinja2015-10-14
| | | | | | | | | - Add warning log level - Change debug_log_level setting to enumeration string - Map Irrlicht log events to MT log events - Encapsulate log_* functions and global variables into a class, Logger - Unify dstream with standard logging mechanism - Unify core.debug() with standard core.log() script API
* Define and use limit constants for Irrlicht fixed-width typeskwolekr2015-10-04
|
* Clean up threadingShadowNinja2015-08-23
| | | | | | | | | | | | | | | | | | | | * Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
* Remove unused functions.onkrot2015-08-16
|
* Fix Lua PcgRandomest312015-08-12
| | | | | | | | | | | | | | | | Before, this lua code led to a crash: local pcg = PcgRandom(42) local value = pcg:next() This was because if you called s32 PcgRandom::range(min, max) with the minimum and maximum possible values for s32 integers (which the lua binding code did), u32 PcgRandom::range(bound) got called with 0 as the bound. The bound however is one above the maximum value, so 0 is a "special" value to pass to this function. This commit fixes the lua crash by assigning the RNG's full range to the bound 0, which is also fits to the "maximum is bound - 1" principle, as (u32)-1 is the maximum value in the u32 range.
* Improve accuracy and safety of float serializationkwolekr2015-08-01
| | | | | | | | | Multiplying by a factor of 1/1000.f (rather than dividing by 1000.f) directly introduces an error of 1 ULP. With this patch, an exact comparison of a floating point literal with the deserialized F1000 form representing it is now guaranteed to be successful. In addition, the maxmium and minimum safely representible floating point numbers are now well-defined as constants.
* Clean up util/serialization.{cpp,h} and add unit testskwolekr2015-08-01
|
* tests: Log exceptions thrown inside of unit testskwolekr2015-07-31
|
* Add AreaStore data structureest312015-07-27
|
* Add more robust error checking to deSerialize*String routineskwolekr2015-07-13
| | | | | Add serializeHexString() Clean up util/serialize.cpp
* Use UTF-8 instead of narrowest312015-07-08
| | | | | Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places. Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
* Fix wrap_rows at inner byte of multibyte sequencefigec2015-06-18
| | | | Also fix UTF-8 inner byte bounds and make unittest for case this fixes.
* Make wrap_rows not wrap inside utf-8 multibyte sequencesest312015-06-17
| | | | | | Also count multibyte sequences as "one" character. Adds unittest for the bug reporter's case. Fixes #2796.
* Add UTF and other utility unit testsest312015-06-14
|
* Split ObjDef/ObjDefManager out to objdef.cppkwolekr2015-05-18
|
* Add -Wsign-compare for Clang builds and fix some signed/unsigned compiler ↵kwolekr2015-05-16
| | | | warnings
* Schematics: Add per-node force placement optionkwolekr2015-05-09
|
* Fix compilation for non-client builds, and fix signed comparison warningkwolekr2015-05-08
|
* Tests: Add schematic unittestskwolekr2015-05-08
| | | | | Improve schematic file-saving interface Add ability to create temporary test files
* NodeResolver: Remove NodeResolveMethodkwolekr2015-05-07
| | | | This simplifies NodeResolver logic and makes some interfaces cleaner.
>,10); if ((id_raw != "") && (*endptr == 0)) { retval.author.id = numbervalue; } else { errorstream << "readModStoreModDetails: missing author id (convert)" << std::endl; retval.valid = false; } } else { errorstream << "readModStoreModDetails: missing author id" << std::endl; retval.valid = false; } if (details["author"]["username"].asString().size()) { retval.author.username = details["author"]["username"].asString(); } else { errorstream << "readModStoreModDetails: missing author username" << std::endl; retval.valid = false; } } else { errorstream << "readModStoreModDetails: missing author" << std::endl; retval.valid = false; } //license if (details["license"].isObject()) { if (details["license"]["id"].asString().size()) { std::string id_raw = details["license"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.license.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing license id" << std::endl; retval.valid = false; } if (details["license"]["short"].asString().size()) { retval.license.shortinfo = details["license"]["short"].asString(); } else { errorstream << "readModStoreModDetails: missing license short" << std::endl; retval.valid = false; } if (details["license"]["link"].asString().size()) { retval.license.url = details["license"]["link"].asString(); } } //titlepic if (details["titlepic"].isObject()) { if (details["titlepic"]["id"].asString().size()) { std::string id_raw = details["titlepic"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.titlepic.id = numbervalue; } } if (details["titlepic"]["file"].asString().size()) { retval.titlepic.file = details["titlepic"]["file"].asString(); } if (details["titlepic"]["desc"].asString().size()) { retval.titlepic.description = details["titlepic"]["desc"].asString(); } if (details["titlepic"]["mod"].asString().size()) { std::string mod_raw = details["titlepic"]["mod"].asString(); char* endptr = 0; int numbervalue = strtol(mod_raw.c_str(),&endptr,10); if ((mod_raw != "") && (*endptr == 0)) { retval.titlepic.mod = numbervalue; } } } //id if (details["id"].asString().size()) { std::string id_raw = details["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing id" << std::endl; retval.valid = false; } //title if (details["title"].asString().size()) { retval.title = details["title"].asString(); } else { errorstream << "readModStoreModDetails: missing title" << std::endl; retval.valid = false; } //basename if (details["basename"].asString().size()) { retval.basename = details["basename"].asString(); } else { errorstream << "readModStoreModDetails: missing basename" << std::endl; retval.valid = false; } //description if (details["desc"].asString().size()) { retval.description = details["desc"].asString(); } //repository if (details["replink"].asString().size()) { retval.repository = details["replink"].asString(); } //value if (details["rating"].asString().size()) { std::string id_raw = details["rating"].asString(); char* endptr = 0; float numbervalue = strtof(id_raw.c_str(),&endptr); if ((id_raw != "") && (*endptr == 0)) { retval.rating = numbervalue; } } else { retval.rating = 0.0; } //depends if (details["depends"].isArray()) { //TODO } //softdepends if (details["softdep"].isArray()) { //TODO } //screenshot url if (details["screenshot_url"].asString().size()) { retval.screenshot_url = details["screenshot_url"].asString(); } return retval; }