• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender / 1507843000

21 Oct 2024 08:08AM UTC coverage: 76.257% (-0.05%) from 76.305%
1507843000

push

gitlab-ci

web-flow
Merge pull request #1676 from kacf/size_fixes

MEN-7613: Size fixes

48 of 72 new or added lines in 18 files covered. (66.67%)

3 existing lines in 2 files now uncovered.

7313 of 9590 relevant lines covered (76.26%)

11280.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/common/expected.hpp
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
#ifndef MENDER_COMMON_EXPECTED_HPP
16
#define MENDER_COMMON_EXPECTED_HPP
17

18
#ifdef __cpp_lib_expected
19
#include <expected>
20
#else
21
#include <tl/expected.hpp>
22
#endif
23

24
#include <common/error.hpp>
25

26
#include <cassert>
27
#include <cstdint>
28
#include <string>
29
#include <vector>
30
#include <unordered_set>
31

32

33
namespace mender {
34
namespace common {
35
namespace expected {
36

37
using namespace std;
38

39
#ifdef __cpp_lib_expected
40
using std::expected;
41
using std::unexpected;
42
#else
43
using tl::expected;
44
template <typename V>
45
tl::unexpected<V> unexpected(V &&v) {
UNCOV
46
        return tl::make_unexpected(v);
×
47
}
48
template <typename V>
49
tl::unexpected<V> unexpected(V &v) {
50
        return tl::make_unexpected(v);
304✔
51
}
52
#endif
53

54
template <typename T>
55
using Expected = expected<T, error::Error>;
56

57
using ExpectedString = Expected<string>;
58
using ExpectedBytes = Expected<vector<uint8_t>>;
59
using ExpectedInt = Expected<int>;
60
using ExpectedInt64 = Expected<int64_t>;
61
using ExpectedDouble = Expected<double>;
62
using ExpectedBool = Expected<bool>;
63
using ExpectedSize = Expected<size_t>;
64
using ExpectedBool = Expected<bool>;
65
using ExpectedLong = Expected<long>;
66
using ExpectedLongLong = Expected<long long>;
67
using ExpectedStringVector = Expected<vector<string>>;
68

69
template <typename T>
70
using ExpectedVector = Expected<vector<T>>;
71

72
template <typename T>
73
using ExpectedUnorderedSet = Expected<unordered_set<T>>;
74

75
} // namespace expected
76
} // namespace common
77
} // namespace mender
78

79
#endif // MENDER_COMMON_EXPECTED_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc