aboutsummaryrefslogtreecommitdiff
path: root/src/util/serialize.h
Commit message (Collapse)AuthorAge
* Fix most warnings, re-fix MSVC compile errorkwolekr2013-02-26
|
* Update Copyright YearsSfan52013-02-24
|
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
|
* Const-correct util/serialize.hPerttu Ahola2012-12-02
|
* Framework for the attachment system, new object property which allows ↵MirceaKitsune2012-11-25
| | | | | | | | | | | | | | changing the color and alpha of mesh materials New object property which allows changing the color and alpha of mesh materials. Due to the current lighting systems it doesn't work yet, but the full implementation is there Framework for the attachment system, with no actual functionality yet Send bone and player object to the setAttachment function in content_sao.cpp, but we need a way to translate it there and send it to the client I will also want position and rotation offsets to be possible to apply to attachments Network object ID from server to client. This will be used to identify the parent client-side and know what to attach to
* Optimize headersPerttu Ahola2012-06-17
|
* Initially split utility.h to multiple files in util/Perttu Ahola2012-06-17
m">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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <server.h> #include "test.h" #include "util/string.h" #include "util/serialize.h" class FakeServer : public Server { public: // clang-format off FakeServer() : Server("fakeworld", SubgameSpec("fakespec", "fakespec"), true, Address(), true, nullptr) { } // clang-format on private: void SendChatMessage(session_t peer_id, const ChatMessage &message) { // NOOP } }; class TestServerShutdownState : public TestBase { public: TestServerShutdownState() { TestManager::registerTestModule(this); } const char *getName() { return "TestServerShutdownState"; } void runTests(IGameDef *gamedef); void testInit(); void testReset(); void testTrigger(); void testTick(); }; static TestServerShutdownState g_test_instance; void TestServerShutdownState::runTests(IGameDef *gamedef) { TEST(testInit); TEST(testReset); TEST(testTrigger); TEST(testTick); } void TestServerShutdownState::testInit() { Server::ShutdownState ss; UASSERT(!ss.is_requested); UASSERT(!ss.should_reconnect); UASSERT(ss.message.empty()); UASSERT(ss.m_timer == 0.0f); } void TestServerShutdownState::testReset() { Server::ShutdownState ss; ss.reset(); UASSERT(!ss.is_requested); UASSERT(!ss.should_reconnect); UASSERT(ss.message.empty()); UASSERT(ss.m_timer == 0.0f); } void TestServerShutdownState::testTrigger() { Server::ShutdownState ss; ss.trigger(3.0f, "testtrigger", true); UASSERT(!ss.is_requested); UASSERT(ss.should_reconnect); UASSERT(ss.message == "testtrigger"); UASSERT(ss.m_timer == 3.0f); } void TestServerShutdownState::testTick() { std::unique_ptr<FakeServer> fakeServer(new FakeServer()); Server::ShutdownState ss; ss.trigger(28.0f, "testtrigger", true); ss.tick(0.0f, fakeServer.get()); // Tick with no time should not change anything UASSERT(!ss.is_requested); UASSERT(ss.should_reconnect); UASSERT(ss.message == "testtrigger"); UASSERT(ss.m_timer == 28.0f); // Tick 2 seconds ss.tick(2.0f, fakeServer.get()); UASSERT(!ss.is_requested); UASSERT(ss.should_reconnect); UASSERT(ss.message == "testtrigger"); UASSERT(ss.m_timer == 26.0f); // Tick remaining seconds + additional expire ss.tick(26.1f, fakeServer.get()); UASSERT(ss.is_requested); UASSERT(ss.should_reconnect); UASSERT(ss.message == "testtrigger"); UASSERT(ss.m_timer == 0.0f); }