File: configuration_mock.hpp

package info (click to toggle)
seqan3 3.0.2%2Bds-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 16,052 kB
  • sloc: cpp: 144,641; makefile: 1,288; ansic: 294; sh: 228; xml: 217; javascript: 50; python: 27; php: 25
file content (110 lines) | stat: -rw-r--r-- 2,942 bytes parent folder | download
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// -----------------------------------------------------------------------------------------------------
// Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
// Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
// -----------------------------------------------------------------------------------------------------

#include "gtest/gtest.h"

#include <array>

#include <seqan3/core/algorithm/configuration_utility.hpp>
#include <seqan3/core/algorithm/pipeable_config_element.hpp>

enum class test_algo_id : uint8_t
{
    bar_id = 0,
    bax_id = 1,
    foo_id = 2,
    foobar_id = 3,
    SIZE = 4
};

namespace seqan3::detail
{

template <>
inline constexpr std::array<std::array<bool, static_cast<uint8_t>(::test_algo_id::SIZE)>,
                            static_cast<uint8_t>(::test_algo_id::SIZE)> compatibility_table<::test_algo_id>
{{
    {0, 1, 1, 1},
    {1, 0, 1, 0},
    {1, 1, 0, 1},
    {1, 0, 1, 0}
}};

}  // namespace seqan3::detail

class bar : public seqan3::pipeable_config_element<bar>
{
public:
    int value{};

    constexpr bar() = default;
    constexpr bar(bar const &) = default;
    constexpr bar(bar &&) = default;
    constexpr bar & operator=(bar const &) = default;
    constexpr bar & operator=(bar &&) = default;
    ~bar() = default;

    constexpr bar(int v) : value{v}
    {}

    static constexpr test_algo_id id{test_algo_id::bar_id};
};

class bax : public seqan3::pipeable_config_element<bax>
{
public:
    float value{};

    constexpr bax() = default;
    constexpr bax(bax const &) = default;
    constexpr bax(bax &&) = default;
    constexpr bax & operator=(bax const &) = default;
    constexpr bax & operator=(bax &&) = default;
    ~bax() = default;

    constexpr bax(float v) : value{v}
    {}

    static constexpr test_algo_id id{test_algo_id::bax_id};
};

class foo : public seqan3::pipeable_config_element<foo>
{
public:
    std::string value{};

    foo() = default;
    foo(foo const &) = default;
    foo(foo &&) = default;
    foo & operator=(foo const &) = default;
    foo & operator=(foo &&) = default;
    ~foo() = default;

    foo(std::string v) : value{v}
    {}

    static constexpr test_algo_id id{test_algo_id::foo_id};
};

template <typename t = std::vector<int>>
class foobar : public seqan3::pipeable_config_element<foobar<t>>
{
public:
    t value{};

    constexpr foobar() = default;
    constexpr foobar(foobar const &) = default;
    constexpr foobar(foobar &&) = default;
    constexpr foobar & operator=(foobar const &) = default;
    constexpr foobar & operator=(foobar &&) = default;
    ~foobar() = default;

    constexpr foobar(t v) : value{v}
    {}

    static constexpr test_algo_id id{test_algo_id::foobar_id};
};