Fix compare between pointer and 0 in unittests
authorJozef Behran <jozuejozef@gmail.com>
Tue, 13 Aug 2019 12:26:37 +0000 (14:26 +0200)
committersfan5 <sfan5@live.de>
Tue, 13 Aug 2019 12:44:32 +0000 (14:44 +0200)
Pointers shall be set to nullptr, not 0, according to the
coding standards. By implication they shall be compared with
nullptr, not 0, too. Fix this code to match that.

src/unittest/test.cpp

index 3ac8ffb193885e971856ee03f9709b5698ec0212..a783ccd3293d7cbea5c6a06f8c8ae4a4f3465dda 100644 (file)
@@ -650,12 +650,12 @@ struct TestMapSector: public TestBase
                // Create one with no heightmaps
                ServerMapSector sector(&parent, v2s16(1,1));
 
-               UASSERT(sector.getBlockNoCreateNoEx(0) == 0);
-               UASSERT(sector.getBlockNoCreateNoEx(1) == 0);
+               UASSERT(sector.getBlockNoCreateNoEx(0) == nullptr);
+               UASSERT(sector.getBlockNoCreateNoEx(1) == nullptr);
 
                MapBlock * bref = sector.createBlankBlock(-2);
 
-               UASSERT(sector.getBlockNoCreateNoEx(0) == 0);
+               UASSERT(sector.getBlockNoCreateNoEx(0) == nullptr);
                UASSERT(sector.getBlockNoCreateNoEx(-2) == bref);
 
                //TODO: Check for AlreadyExistsException