File: core_language_test.cpp

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 (97 lines) | stat: -rw-r--r-- 3,040 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
// -----------------------------------------------------------------------------------------------------
// 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 <random>

#include <seqan3/core/concept/core_language.hpp>
#include <seqan3/std/iterator>

#include "auxiliary.hpp"

TEST(core_language_concepts, same_as)
{
    EXPECT_TRUE((std::same_as<int, int>));
    EXPECT_TRUE((!std::same_as<int, char>));
}

TEST(core_language_concepts, derived_from)
{
    EXPECT_TRUE((std::derived_from<type_b, type_a>));
    EXPECT_TRUE((!std::derived_from<type_a, type_b>));
}

TEST(implicitly_convertible_to, basic)
{
    EXPECT_TRUE((seqan3::implicitly_convertible_to<type_b, type_c>));
    EXPECT_TRUE((!seqan3::implicitly_convertible_to<type_c, type_b>));
    EXPECT_TRUE((!seqan3::implicitly_convertible_to<type_a, type_c>));
}

TEST(explicitly_convertible_to, basic)
{
    EXPECT_TRUE((seqan3::explicitly_convertible_to<type_b, type_c>));
    EXPECT_TRUE((!seqan3::explicitly_convertible_to<type_c, type_b>));
    EXPECT_TRUE((seqan3::explicitly_convertible_to<type_a, type_c>));
}

TEST(core_language_concepts, convertible_to)
{
    EXPECT_TRUE((std::convertible_to<type_b, type_c>));
    EXPECT_TRUE((!std::convertible_to<type_c, type_b>));
    EXPECT_TRUE((!std::convertible_to<type_a, type_c>));
}

TEST(core_language_concepts, common_reference_with)
{
    EXPECT_TRUE((std::common_reference_with<int32_t, int16_t>));
    EXPECT_TRUE((!std::common_reference_with<int32_t, type_c>));
}

TEST(core_language_concepts, common_with)
{
    EXPECT_TRUE((std::common_with<type_a, type_b>));
    EXPECT_TRUE((!std::common_with<type_a, type_c>));
}

TEST(core_language_concepts, integral)
{
    EXPECT_TRUE((std::integral<int>));
    EXPECT_TRUE((!std::integral<float>));
}

TEST(core_language_concepts, signed_integral)
{
    EXPECT_TRUE((std::signed_integral<int>));
    EXPECT_TRUE((!std::signed_integral<unsigned>));
}

TEST(core_language_concepts, unsigned_integral)
{
    EXPECT_TRUE((!std::unsigned_integral<int>));
    EXPECT_TRUE((std::unsigned_integral<unsigned>));
}

TEST(core_language_concepts, assignable_from)
{
    EXPECT_TRUE((std::assignable_from<type_a &, type_a const &>));
    EXPECT_TRUE((std::assignable_from<type_c &, type_b const &>));
    EXPECT_TRUE((!std::assignable_from<type_a &, type_c &>));
}

TEST(core_language_concepts, swappable)
{
    EXPECT_TRUE((std::swappable<type_a>));
    EXPECT_TRUE((std::swappable<type_b>));
}

TEST(core_language_concepts, swappable_with)
{
    EXPECT_TRUE((std::swappable_with<type_a &, type_a &>));
    EXPECT_TRUE((!std::swappable_with<type_b, type_c>));
}