Skip to content

Commit

Permalink
Add unittest for .length and .peek (std.digest.digest.WrapperDigest)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpf91 committed Jul 30, 2016
1 parent 69c00bc commit 8cb66be
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions std/digest/digest.d
Original file line number Diff line number Diff line change
Expand Up @@ -992,3 +992,15 @@ unittest
//necessary, result will have the correct length, but buf will still have it's original
//length
}

@safe unittest
{
// Test peek & length
import std.digest.crc;
auto hash = new WrapperDigest!CRC32();
assert(hash.length == 4);
hash.put(cast(const(ubyte[]))"The quick brown fox jumps over the lazy dog");
assert(hash.peek().toHexString() == "39A34F41");
ubyte[5] buf;
assert(hash.peek(buf).toHexString() == "39A34F41");
}

0 comments on commit 8cb66be

Please sign in to comment.