-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathe2sar_opt_test.cpp
More file actions
41 lines (34 loc) · 1.12 KB
/
e2sar_opt_test.cpp
File metadata and controls
41 lines (34 loc) · 1.12 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
#define BOOST_TEST_MODULE DPOptTests
#include <boost/test/included/unit_test.hpp>
#include <vector>
#include "e2sarUtil.hpp"
using namespace e2sar;
BOOST_AUTO_TEST_SUITE(DPOptTests)
// these tests test the way Optimizations object works
BOOST_AUTO_TEST_CASE(DPOptTest1)
{
// basic conversions
BOOST_CHECK(Optimizations::toString(Optimizations::Code::sendmmsg) == "sendmmsg"s);
BOOST_CHECK(Optimizations::toString(Optimizations::Code::unknown) == "unknown"s);
BOOST_CHECK(Optimizations::fromString("sendmmsg") == Optimizations::Code::sendmmsg);
BOOST_CHECK(Optimizations::fromString("liburing_send") == Optimizations::Code::liburing_send);
auto avail = Optimizations::availableAsStrings();
bool nonePresent = false;
for(auto a: avail)
{
if (a == "none")
nonePresent = true;
}
BOOST_CHECK(nonePresent == true);
}
BOOST_AUTO_TEST_CASE(DPOptTest2)
{
std::vector<std::string> opts = {"sendmmsg"};
auto res = Optimizations::select(opts);
#ifdef SENDMMSG_AVAILABLE
BOOST_CHECK(not res.has_error());
#else
BOOST_CHECK(res.has_error());
#endif
}
BOOST_AUTO_TEST_SUITE_END()