dedup/tests/hashtest.cpp

24 lines
440 B
C++

#include "test.h"
#include "hash.h"
TEST(hash) {
Hash h;
CMPASSERT(h, false);
CMPASSERT(Hash::create(h, TESTDATA "random.img"), true);
CMPASSERT(h, true);
// fail to write a existing hash
CMPASSERT(Hash::create(h, TESTDATA "random.img"), false);
CMPASSERT(h, true);
CMPASSERT(static_cast<std::string>(h), "de05bb13b33f1cc593348d733b84820c77f8f6be89cf417d21d8b2af81d3ebd8");
CMPASSERT(h, true);
CMPASSERT(h, h);
} TESTEND