本文整理汇总了C++中openstudio::checksum方法的典型用法代码示例。如果您正苦于以下问题:C++ openstudio::checksum方法的具体用法?C++ openstudio::checksum怎么用?C++ openstudio::checksum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openstudio
的用法示例。
在下文中一共展示了openstudio::checksum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checksum
TEST(Checksum, Streams)
{
stringstream ss;
EXPECT_EQ(istream::goodbit, ss.rdstate());
EXPECT_EQ("00000000", checksum(ss));
// checksum tried to read from empty stream and both eof and fail bits are set
EXPECT_EQ(istream::failbit | istream::eofbit, ss.rdstate());
// need to clear the eofbit that was set when checksum read all the way through
ss.clear();
EXPECT_EQ(istream::goodbit, ss.rdstate());
// write some more to the stringstream
ss << "Hi there";
EXPECT_EQ(istream::goodbit, ss.rdstate());
EXPECT_EQ("1AD514BA", checksum(ss));
// checksum read all the way through and eofbit is set
EXPECT_EQ(istream::failbit | istream::eofbit, ss.rdstate());
EXPECT_EQ("00000000", checksum(ss));
EXPECT_EQ(istream::failbit | istream::eofbit, ss.rdstate());
// need to clear the eofbit that was set when checksum read all the way through
ss.clear();
EXPECT_EQ(istream::goodbit, ss.rdstate());
EXPECT_EQ("00000000", checksum(ss));
}
示例2: resourcesPath
TEST(Checksum, Paths)
{
// read a file, contents are "Hi there"
path p = resourcesPath() / toPath("utilities/Checksum/Checksum.txt");
EXPECT_EQ("1AD514BA", checksum(p));
// read a file, contents are "Hi there\r\nGoodbye" on Windows and "Hi there\nGoodbye" otherwise
p = resourcesPath() / toPath("utilities/Checksum/Checksum2.txt");
EXPECT_EQ("17B88D3A", checksum(p));
// checksum of a directory is "00000000"
p = resourcesPath() / toPath("utilities/Checksum/");
EXPECT_EQ("00000000", checksum(p));
// if can't find file return "00000000"
p = resourcesPath() / toPath("utilities/Checksum/NotAFile.txt");
EXPECT_EQ("00000000", checksum(p));
}
示例3:
TEST(Checksum, UUIDs) {
StringVector checksums;
for (unsigned i = 0, n = 1000; i < n; ++i) {
checksums.push_back(checksum(toString(createUUID())));
}
auto itStart = checksums.begin();
++itStart;
for (auto it = checksums.begin(), itEnd = checksums.end();
itStart != itEnd; ++it, ++itStart) {
EXPECT_TRUE(std::find(itStart,itEnd,*it) == itEnd);
}
}