Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core7/test/core/class/IdentifiableTest.cc @ 10405

Last change on this file since 10405 was 10400, checked in by landauf, 10 years ago

fixed tests. however there are some open issues:

  • the class-hierarchy must be built exactly 1 times in core_test. this is currently done in CommandTest.cc because that's the first test to run in core_test which actually needs the class hierarchy. the order of tests is not guaranteed though, so this should be solved more generic
  • during creation of class hierarchy, config values are used. this fails in the tests, so it had to be disabled with a static flag in Identifier. this should be solved in a cleaner way.
  • because the class hierarchy is now statically generated for all tests in core_test in CommandTest.cc, there is no way to test identifiers in an uninitialized state. because of this, three tests had to be disabled (*_NoFixture tests)

⇒ make the creation of the class hierarchy more modular and fix these issues

  • Property svn:eol-style set to native
File size: 802 bytes
Line 
1#include <gtest/gtest.h>
2#include "core/CoreIncludes.h"
3#include "core/class/Identifiable.h"
4
5namespace orxonox
6{
7    namespace
8    {
9        class IdentifiableTest : public Identifiable
10        {
11            public:
12                IdentifiableTest() { RegisterObject(IdentifiableTest); }
13        };
14
15        RegisterClassNoArgs(IdentifiableTest);
16    }
17
18    TEST(IdentifiableTest, CanCreate)
19    {
20        IdentifiableTest* test = new IdentifiableTest();
21        ASSERT_TRUE(test != NULL);
22        delete test;
23    }
24
25    TEST(IdentifiableTest, HasIdentifierAssigned)
26    {
27        IdentifiableTest test;
28        EXPECT_TRUE(test.getIdentifier());
29    }
30
31    TEST(IdentifiableTest, CanBeIdentified)
32    {
33        IdentifiableTest test;
34        EXPECT_TRUE(test.isA(Class(IdentifiableTest)));
35    }
36}
Note: See TracBrowser for help on using the repository browser.