mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 18:45:36 +00:00
Merge branch 'fix_get_hash' into 'master'
Fix recover from errors in Files::getHash See merge request OpenMW/openmw!1777
This commit is contained in:
commit
c78cc38383
2 changed files with 11 additions and 1 deletions
|
@ -22,6 +22,16 @@ namespace
|
|||
|
||||
struct FilesGetHash : TestWithParam<Params> {};
|
||||
|
||||
TEST(FilesGetHash, shouldClearErrors)
|
||||
{
|
||||
const std::string fileName = "fileName";
|
||||
std::string content;
|
||||
std::fill_n(std::back_inserter(content), 1, 'a');
|
||||
std::istringstream stream(content);
|
||||
stream.exceptions(std::ios::failbit | std::ios::badbit);
|
||||
EXPECT_THAT(getHash(fileName, stream), ElementsAre(9607679276477937801ull, 16624257681780017498ull));
|
||||
}
|
||||
|
||||
TEST_P(FilesGetHash, shouldReturnHashForStringStream)
|
||||
{
|
||||
const std::string fileName = "fileName";
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace Files
|
|||
MurmurHash3_x64_128(value.data(), static_cast<int>(read), hash.data(), blockHash.data());
|
||||
hash = blockHash;
|
||||
}
|
||||
stream.exceptions(exceptions);
|
||||
stream.clear();
|
||||
stream.exceptions(exceptions);
|
||||
stream.seekg(start);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
|
Loading…
Reference in a new issue