Add public example for UUID and enable DScanner check

This commit is contained in:
Sebastian Wilzbach 2018-03-20 18:06:51 +01:00
parent dbb2b98389
commit b6b6b95d76
2 changed files with 14 additions and 1 deletions

View file

@ -961,6 +961,19 @@ public struct UUID
}
}
///
@safe unittest
{
UUID id;
assert(id.empty);
id = randomUUID;
assert(!id.empty);
id = UUID(cast(ubyte[16]) [138, 179, 6, 14, 44, 186, 79,
35, 183, 76, 181, 45, 179, 189, 251, 70]);
assert(id.toString() == "8ab3060e-2cba-4f23-b74c-b52db3bdfb46");
}
/**
* This function generates a name based (Version 3) UUID from a namespace UUID and a name.