-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomparison.cpp
More file actions
77 lines (58 loc) · 1.62 KB
/
Copy pathcomparison.cpp
File metadata and controls
77 lines (58 loc) · 1.62 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Eggs.FlatMap
//
// Copyright Agustin K-ballo Berge, Fusion Fenix 2026
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <eggs/flat_map.hpp>
#include "catch.hpp"
using namespace eggs;
TEST_CASE("comparison/eq/equal", "[comparison]")
{
flat_map<int(float)> a{{1, 1.f}};
flat_map<int(float)> b{{1, 1.f}};
CHECK(a == b);
}
TEST_CASE("comparison/eq/not_equal/key", "[comparison]")
{
flat_map<int(float)> a{{1, 1.f}};
flat_map<int(float)> b{{2, 1.f}};
CHECK(a != b);
}
TEST_CASE("comparison/eq/not_equal/value", "[comparison]")
{
flat_map<int(float)> a{{1, 1.f}};
flat_map<int(float)> b{{1, 2.f}};
CHECK(a != b);
}
TEST_CASE("comparison/eq/not_equal/size", "[comparison]")
{
flat_map<int(float)> a{{1, 1.f}, {2, 2.f}};
flat_map<int(float)> b{{1, 1.f}};
CHECK(a != b);
}
TEST_CASE("comparison/spaceship/less", "[comparison]")
{
flat_map<int(float)> a{{1, 1.f}};
flat_map<int(float)> b{{2, 2.f}};
CHECK(std::is_lt(a <=> b));
}
TEST_CASE("comparison/spaceship/greater", "[comparison]")
{
flat_map<int(float)> a{{2, 2.f}};
flat_map<int(float)> b{{1, 1.f}};
CHECK(std::is_gt(a <=> b));
}
TEST_CASE("comparison/spaceship/equal", "[comparison]")
{
flat_map<int(float)> a{{1, 1.f}};
flat_map<int(float)> b{{1, 1.f}};
CHECK(std::is_eq(a <=> b));
}
TEST_CASE("comparison/spaceship/key_only", "[comparison]")
{
// map with no value types — degenerate Key() case
flat_map<int()> a{{1}};
flat_map<int()> b{{2}};
CHECK(std::is_lt(a <=> b));
}