Add bip buffer and constexpr hash

This commit is contained in:
Justin C. Miller
2019-03-17 10:02:57 -07:00
parent 73756820bd
commit 645938a194
5 changed files with 215 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#include "kutil/constexpr_hash.h"
#include "catch.hpp"
using namespace kutil;
TEST_CASE( "constexpr hash", "[hash]" )
{
const unsigned hash1 = static_cast<unsigned>("hash1!"_h);
CHECK(hash1 == 210);
const unsigned hash2 = static_cast<unsigned>("hash1!"_h);
CHECK(hash1 == hash2);
const unsigned hash3 = static_cast<unsigned>("not hash1!"_h);
CHECK(hash1 != hash3);
CHECK(hash3 == 37);
const unsigned hash4 = static_cast<unsigned>("another thing that's longer"_h);
CHECK(hash1 != hash4);
CHECK(hash4 == 212);
}