-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdaw_array_test.cpp
More file actions
51 lines (39 loc) · 1.33 KB
/
daw_array_test.cpp
File metadata and controls
51 lines (39 loc) · 1.33 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
// 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_array.h"
#include "daw/daw_algorithm.h"
#include "daw/daw_benchmark.h"
#include <array>
#include <string>
using namespace std::literals::string_literals;
constexpr bool make_array_testing( ) {
auto const t = daw::make_array( 1, 2, 3, 4, 5, 6 );
auto pos = daw::algorithm::find( t.begin( ), t.end( ), 4 );
daw::expecting( 4, *pos );
return true;
}
static_assert( make_array_testing( ) );
constexpr bool to_array_testing( ) {
int s[] = { 1, 2, 3, 4, 5, 6 };
auto const t = daw::to_array( s );
auto pos = daw::algorithm::find( t.begin( ), t.end( ), 4 );
daw::expecting( 4, *pos );
return true;
}
static_assert( to_array_testing( ) );
void make_string_array_testing( ) {
auto const t = daw::make_string_array( "1", "2", "3", "4", "5", "6" );
auto pos = daw::algorithm::find( t.begin( ), t.end( ), "4" );
daw::expecting( 1U, pos->size( ) );
daw::expecting( "4", *pos );
}
static_assert( std::is_same_v<std::array<std::array<std::array<int, 5>, 6>, 7>,
daw::md_stdarray_t<int, 7, 6, 5>> );
int main( ) {
make_string_array_testing( );
}