-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdaw_generic_hash_test.cpp
More file actions
62 lines (55 loc) · 1.73 KB
/
Copy pathdaw_generic_hash_test.cpp
File metadata and controls
62 lines (55 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) Darrell Wright
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/beached/header_libraries
//
#include "daw/daw_generic_hash.h"
#include "daw/daw_benchmark.h"
constexpr bool test_01( ) {
auto const c1 = daw::generic_hash( "Hello" );
auto const c2 = daw::generic_hash( "Hello" );
auto const c3 = daw::generic_hash( 5 );
auto const c4 = daw::generic_hash( 0xFF00FF00FF00FF );
daw::expecting( c1, c2 );
daw::expecting( c1 != c3 );
daw::expecting( c1 != c4 );
return true;
}
static_assert( test_01( ) );
/*
constexpr bool test_16_01( ) {
auto const c1 = daw::generic_hash<2>( "Hello" );
auto const c2 = daw::generic_hash<2>( "Hello" );
auto const c3 = daw::generic_hash<2>( 5 );
auto const c4 = daw::generic_hash<2>( 0xFF00FF00FF00FF );
daw::expecting( c1, c2 );
daw::expecting( c1 != c3 );
return true;
}
static_assert( test_16_01( ) );
*/
constexpr bool test_32_01( ) {
auto const c1 = daw::generic_hash<4>( "Hello" );
auto const c2 = daw::generic_hash<4>( "Hello" );
auto const c3 = daw::generic_hash<4>( 5 );
auto const c4 = daw::generic_hash<4>( 0xFF00FF00FF00FF );
daw::expecting( c1, c2 );
daw::expecting( c1 != c3 );
daw::expecting( c1 != c4 );
return true;
}
static_assert( test_32_01( ) );
constexpr bool test_64_01( ) {
auto const c1 = daw::generic_hash<8>( "Hello" );
auto const c2 = daw::generic_hash<8>( "Hello" );
auto const c3 = daw::generic_hash<8>( 5 );
auto const c4 = daw::generic_hash<8>( 0xFF00FF00FF00FF );
daw::expecting( c1, c2 );
daw::expecting( c1 != c3 );
daw::expecting( c1 != c4 );
return true;
}
static_assert( test_64_01( ) );
int main( ) {}