]> git.lizzy.rs Git - minetest.git/blob - src/unittest/test_activeobject.cpp
872130a2a03a727ec72cc90a8d4f5b54033b65f1
[minetest.git] / src / unittest / test_activeobject.cpp
1 /*
2 Minetest
3 Copyright (C) 2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "test.h"
21
22 #include "mock_activeobject.h"
23
24 class TestActiveObject : public TestBase
25 {
26 public:
27         TestActiveObject() { TestManager::registerTestModule(this); }
28         const char *getName() { return "TestActiveObject"; }
29
30         void runTests(IGameDef *gamedef);
31
32         void testAOAttributes();
33 };
34
35 static TestActiveObject g_test_instance;
36
37 void TestActiveObject::runTests(IGameDef *gamedef)
38 {
39         TEST(testAOAttributes);
40 }
41
42 void TestActiveObject::testAOAttributes()
43 {
44         MockActiveObject ao(44);
45         UASSERT(ao.getId() == 44);
46
47         ao.setId(558);
48         UASSERT(ao.getId() == 558);
49 }