From 4fc3dd9d20edadff8eff1c395478e82d3123eb64 Mon Sep 17 00:00:00 2001 From: Marius Bancila Date: Mon, 18 Dec 2017 17:39:22 +0200 Subject: [PATCH] more tests --- test/test.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/test/test.cpp b/test/test.cpp index a1a2b20..3b046c1 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -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 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;