aboutsummaryrefslogtreecommitdiff
path: root/src/unittest
AgeCommit message (Collapse)Author
2017-01-07Extend minetest.is_yes()red-001
2017-01-04Improve getPointedThing() (#4346)Dániel Juhász
* 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()).
2017-01-01Breath cheat fix: server sideLoic Blot
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
2016-12-20Fix RemoveRelatvePathComponentsShadowNinja
This used to return "/foo" for "../foo" when it should return the enpty string (i.e., error removing all relative components).
2016-11-27Fix filepath > RemoveRelativePathComponent unittestsfan5
(was broken by e4ee6548afd01040046ee3780d0fbb121d141251)
2016-10-30Fix overloading problems mentioned by clangLoic Blot
2016-10-30PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul
* 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
2016-10-27Add unittests to test player saving/loading (#4679)Ner'zhul
2016-10-06Travis: build matrix improvements + CPP11 buildLoic Blot
2016-09-29Only include keycode unittests in client build (fixes #4559)sfan5
2016-09-25Add keycode.cpp unittestssfan5
2016-08-10couple of memory leaks fixes.David Carlier
2016-08-04Mapgen: Remove unused 'flat' and 'trees' flags from mg_flagsparamat
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.
2016-08-04test_map_settings_manager: Fix Wunused-result warningest31
2016-07-04Temporarily disable "testStartStopWait" Threading unit test on macest31
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.
2016-07-03Add MapSettingsManager and new mapgen setting script API functionskwolekr
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.
2016-04-24Escape more strings: formspecs, item descriptions, infotexts...Ekdohibs
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.
2016-03-07Implement AreaStore serializationShadowNinja
2016-03-07Move AreaStore to utilShadowNinja
2016-03-07Simplify AreaStore ID managementShadowNinja
2016-01-29Don't pass non-const references to collision methodsest31
Non const references cause a lot of confusion with behaviour of code, and are disallowed by minetest style guide.
2015-11-06Add server side ncurses terminalest31
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.
2015-10-26Remove some abort() callsest31
abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
2015-10-24Fix some threading things and add additional thread unittestskwolekr
- Fix thread name reset on start() - Fully reset thread state on kill() - Add unittests to check for correct object states under various circumstances
2015-10-15Add BufReader and vector-based serialization methodskwolekr
2015-10-14Rename macros with two leading underscoresShadowNinja
These names are reserved for the compiler/library implementations.
2015-10-14Refactor loggingShadowNinja
- 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
2015-10-04Define and use limit constants for Irrlicht fixed-width typeskwolekr
2015-08-23Clean up threadingShadowNinja
* 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.
2015-08-16Remove unused functions.onkrot
2015-08-12Fix Lua PcgRandomest31
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.
2015-08-01Improve accuracy and safety of float serializationkwolekr
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.
2015-08-01Clean up util/serialization.{cpp,h} and add unit testskwolekr
2015-07-31tests: Log exceptions thrown inside of unit testskwolekr
2015-07-27Add AreaStore data structureest31
2015-07-13Add more robust error checking to deSerialize*String routineskwolekr
Add serializeHexString() Clean up util/serialize.cpp
2015-07-08Use UTF-8 instead of narrowest31
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.
2015-06-18Fix wrap_rows at inner byte of multibyte sequencefigec
Also fix UTF-8 inner byte bounds and make unittest for case this fixes.
2015-06-17Make wrap_rows not wrap inside utf-8 multibyte sequencesest31
Also count multibyte sequences as "one" character. Adds unittest for the bug reporter's case. Fixes #2796.
2015-06-14Add UTF and other utility unit testsest31
2015-05-18Split ObjDef/ObjDefManager out to objdef.cppkwolekr
2015-05-16Add -Wsign-compare for Clang builds and fix some signed/unsigned compiler ↵kwolekr
warnings
2015-05-09Schematics: Add per-node force placement optionkwolekr
2015-05-08Fix compilation for non-client builds, and fix signed comparison warningkwolekr
2015-05-08Tests: Add schematic unittestskwolekr
Improve schematic file-saving interface Add ability to create temporary test files
2015-05-07NodeResolver: Remove NodeResolveMethodkwolekr
This simplifies NodeResolver logic and makes some interfaces cleaner.
2015-05-05Fix build on Debian broken by b45df9d (missing include, somehow?)kwolekr
2015-05-05NodeDefManager: Improve const-correctness of interfaceskwolekr
- Add ability to explicitly reset NodeResolve state (useful for unittesting) - Remove non-essential NodeResolve methods modifying state from INodeDefManager - Add const qualifier to NodeDefManager and ContentFeatures serialize
2015-05-05Tests: Add NodeResolver unittestskwolekr
Minor misc. NodeResolver cleanups Prefix faux content type constants for testing with t_ to avoid confusion or name collisions
2015-05-04Fix GCC compiler warningShadowNinja