mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Add bip buffer and constexpr hash
This commit is contained in:
21
src/tests/constexpr_hash.cpp
Normal file
21
src/tests/constexpr_hash.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user