Files
jsix/src/tests/constexpr_hash.cpp
F in Chat for Tabs 8f529046a9 [project] Lose the battle between tabs & spaces
I'm a tabs guy. I like tabs, it's an elegant way to represent
indentation instead of brute-forcing it. But I have to admit that the
world seems to be going towards spaces, and tooling tends not to play
nice with tabs. So here we go, changing the whole repo to spaces since
I'm getting tired of all the inconsistent formatting.
2021-08-01 17:46:16 -07:00

22 lines
555 B
C++

#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);
}