/** * Verify page cache data. * This function reads the EEPROM using dbg functions, * since there's no way to read the contents of the cache * using the I2C interface. * The expected page cache data is compared to the * actual page cache data and then compared using * CompareByteArrays(). * @param page_cache_expected Expected data. * @param size Size of expected data. * @param message Optional message for this verification. */ void EEPRomI2CTest::VerifyPageCacheData_dbg(const uint8_t *page_cache_expected, unsigned int size, const string &message) { unsigned int pgSize; ASSERT_EQ(0, m_eeprom->dbg_getPageSize(&pgSize)); ASSERT_EQ(pgSize, size); // Get the data from the page cache. vector<uint8_t> page_cache_actual(pgSize, 0xFF); ASSERT_EQ(0, m_eeprom->dbg_readPageCache(0, page_cache_actual.data(), pgSize)); // Verify the page cache data. CompareByteArrays(page_cache_expected, page_cache_actual.data(), pgSize, "page cache", message); }
/** * Verify EEPROM data. * This function reads the EEPROM using dbg functions, * not the I2C interface. * The expected EEPROM data is compared to the * actual EEPROM data and then compared using * CompareByteArrays(). * @param eeprom_expected Expected data. * @param size Size of expected data. * @param message Optional message for this verification. */ void EEPRomI2CTest::VerifyEEPRomData_dbg(const uint8_t *eeprom_expected, unsigned int size, const string &message) { unsigned int eepromSize; ASSERT_EQ(0, m_eeprom->dbg_getEEPRomSize(&eepromSize)); ASSERT_EQ(eepromSize, size); // Get the data from the EEPROM. vector<uint8_t> eeprom_actual(eepromSize, 0xFF); ASSERT_EQ(0, m_eeprom->dbg_readEEPRom(0, eeprom_actual.data(), eepromSize)); // Verify the EEPROM data. CompareByteArrays(eeprom_expected, eeprom_actual.data(), eepromSize, "EEPROM", message); }
bool WarlockeryModelLoader::VerifyWarlockeryModelFile(FileHeader* fileHeader){ unsigned char* WarlockeryModelFourCC = new unsigned char[4]; WarlockeryModelFourCC[0] = 'G'; WarlockeryModelFourCC[1] = 'C'; WarlockeryModelFourCC[2] = '2'; WarlockeryModelFourCC[3] = '3'; if (CompareByteArrays(fileHeader->fourCC, WarlockeryModelFourCC, 4)){ if (fileHeader->subtype == (unsigned char)2){ if (fileHeader->version == (unsigned char)1){ return true; } } } return false; }