more tests

This commit is contained in:
Marius Bancila 2017-12-18 17:39:22 +02:00
parent 5bf5250bca
commit 4fc3dd9d20

View File

@ -29,7 +29,8 @@ int main()
{
uuid guid("47183823-2574-4bfd-b411-99ed177d3e43");
assert(guid.string() == "47183823-2574-4bfd-b411-99ed177d3e43"s);
assert(guid.string() == "47183823-2574-4bfd-b411-99ed177d3e43");
assert(guid.wstring() == L"47183823-2574-4bfd-b411-99ed177d3e43");
}
}
@ -168,6 +169,31 @@ int main()
assert(empty.wstring() == L"00000000-0000-0000-0000-000000000000");
}
{
std::cout << "Test iterators" << std::endl;
std::array<uint8_t, 16> arr{
0x47, 0x18, 0x38, 0x23,
0x25, 0x74,
0x4b, 0xfd,
0xb4, 0x11,
0x99, 0xed, 0x17, 0x7d, 0x3e, 0x43
};
uuid guid;
assert(guid.nil());
std::copy(std::cbegin(arr), std::cend(arr), std::begin(guid));
assert(!guid.nil());
assert(guid.string() == "47183823-2574-4bfd-b411-99ed177d3e43");
size_t i = 0;
for (auto const & b : guid)
{
assert(arr[i++] == b);
}
}
{
std::cout << "Test constexpr" << std::endl;