ObjectId constructor translates a hex string (24 characters) into a 12 byte object id

This commit is contained in:
fbraem
2014-12-20 19:11:16 +01:00
parent 9f7076d7a7
commit eb879985b0
3 changed files with 46 additions and 28 deletions

View File

@@ -402,21 +402,7 @@ void MongoDBTest::testConnectionPool()
void MongoDBTest::testObjectID()
{
std::string str;
str.append(1, (char) 0x53);
str.append(1, (char) 0x6A);
str.append(1, (char) 0xEE);
str.append(1, (char) 0xBB);
str.append(1, (char) 0xA0);
str.append(1, (char) 0x81);
str.append(1, (char) 0xDE);
str.append(1, (char) 0x68);
str.append(1, (char) 0x15);
str.append(1, (char) 0x00);
str.append(1, (char) 0x00);
str.append(1, (char) 0x02);
ObjectId oid(str);
ObjectId oid("536aeebba081de6815000002");
std::string str2 = oid.toString();
assert(str2 == "536aeebba081de6815000002");
}