| 1 |
/* |
| 2 |
* Descent 3 |
| 3 |
* Copyright (C) 2024 Descent Developers |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation, either version 3 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 General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <gtest/gtest.h> |
| 20 |
|
| 21 |
#include "osiris_predefs.h" |
| 22 |
#include "osiris_share.h" |
| 23 |
#include "player_external_struct.h" |
| 24 |
|
| 25 |
// This is copy of actual Osiris_CreateGameChecksum(void) from OsirisLoadandBind.cpp |
| 26 |
uint32_t Osiris_CreateGameChecksumTest() { |
| 27 |
uint32_t value = 0xe1e1b0b0; |
| 28 |
|
| 29 |
value += sizeof(object); |
| 30 |
value += sizeof(player) * 2; |
| 31 |
value += sizeof(tOSIRISModuleInit) * 3; |
| 32 |
value += sizeof(tOSIRISEventInfo) * 5; |
| 33 |
value += sizeof(tOSIRISTIMER) * 7; |
| 34 |
value += sizeof(tOSIRISSCRIPTID) * 11; |
| 35 |
value += sizeof(tOSIRISMEMCHUNK) * 13; |
| 36 |
value += sizeof(msafe_struct) * 17; |
| 37 |
value += sizeof(ray_info) * 19; |
| 38 |
value += sizeof(vector) * 23; |
| 39 |
value += sizeof(matrix) * 29; |
| 40 |
value += sizeof(tGameCinematic) * 31; |
| 41 |
value += sizeof(tCannedCinematicInfo) * 37; |
| 42 |
|
| 43 |
value = value << 2; |
| 44 |
|
| 45 |
/* Adds count of Osiris_module_init.fp */ |
| 46 |
value += 123; |
| 47 |
|
| 48 |
return value; |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
TEST(D3, OsirisTests) { |
| 53 |
EXPECT_EQ(Osiris_CreateGameChecksumTest(), CHECKSUM); |
| 54 |
} |