summaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vespalib/src/tests')
-rw-r--r--vespalib/src/tests/delegatelist/delegatelist.cpp8
-rw-r--r--vespalib/src/tests/explore_modern_cpp/explore_modern_cpp_test.cpp2
-rw-r--r--vespalib/src/tests/net/async_resolver/async_resolver_test.cpp4
-rw-r--r--vespalib/src/tests/priority_queue/priority_queue_test.cpp10
-rw-r--r--vespalib/src/tests/stllike/hash_test.cpp12
-rw-r--r--vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp16
-rw-r--r--vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp2
7 files changed, 27 insertions, 27 deletions
diff --git a/vespalib/src/tests/delegatelist/delegatelist.cpp b/vespalib/src/tests/delegatelist/delegatelist.cpp
index 070864dd85a..4dc7e5c97d7 100644
--- a/vespalib/src/tests/delegatelist/delegatelist.cpp
+++ b/vespalib/src/tests/delegatelist/delegatelist.cpp
@@ -77,15 +77,15 @@ struct Command
int cmd;
int cnt;
Handler *handler;
- Command(DL *dl_, int cmd_, int cnt_, Handler *handler_)
+ Command(DL *dl_, int cmd_, int cnt_, Handler *handler_) noexcept
: dl(dl_), cmd(cmd_), cnt(cnt_), handler(handler_) {}
- Command(const Command &rhs)
+ Command(const Command &rhs) noexcept
: dl(rhs.dl), cmd(rhs.cmd), cnt(rhs.cnt), handler(rhs.handler) {}
- Command &operator=(const Command &rhs) {
+ Command &operator=(const Command &rhs) noexcept {
memcpy(this, &rhs, sizeof(Command));
return *this;
}
- bool operator==(const Command &rhs) {
+ bool operator==(const Command &rhs) noexcept {
return memcmp(this, &rhs, sizeof(Command)) == 0;
}
};
diff --git a/vespalib/src/tests/explore_modern_cpp/explore_modern_cpp_test.cpp b/vespalib/src/tests/explore_modern_cpp/explore_modern_cpp_test.cpp
index 1ba368b39a3..29a82138d29 100644
--- a/vespalib/src/tests/explore_modern_cpp/explore_modern_cpp_test.cpp
+++ b/vespalib/src/tests/explore_modern_cpp/explore_modern_cpp_test.cpp
@@ -5,7 +5,7 @@
TEST("verify how std::function copies lambda closures") {
size_t count = 0;
size_t value = 0;
- auto closure = [count,&value]()mutable{ ++count; value += count; };
+ auto closure = [count,&value]() mutable noexcept { ++count; value += count; };
closure();
EXPECT_EQUAL(0u, count);
EXPECT_EQUAL(1u, value); // +1
diff --git a/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp b/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp
index 434cb8d6a69..eca43ea5cec 100644
--- a/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp
+++ b/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp
@@ -11,7 +11,7 @@ using namespace vespalib;
struct ResultSetter : public AsyncResolver::ResultHandler {
SocketAddress &addr;
std::atomic<bool> done;
- ResultSetter(SocketAddress &addr_out) : addr(addr_out), done(false) {}
+ ResultSetter(SocketAddress &addr_out) noexcept : addr(addr_out), done(false) {}
void handle_result(SocketAddress result) override {
addr = result;
done = true;
@@ -31,7 +31,7 @@ struct MyClock : public AsyncResolver::Clock {
struct BlockingHostResolver : public AsyncResolver::HostResolver {
CountDownLatch callers;
Gate barrier;
- BlockingHostResolver(size_t num_callers)
+ BlockingHostResolver(size_t num_callers) noexcept
: callers(num_callers), barrier() {}
vespalib::string ip_address(const vespalib::string &) override {
callers.countDown();
diff --git a/vespalib/src/tests/priority_queue/priority_queue_test.cpp b/vespalib/src/tests/priority_queue/priority_queue_test.cpp
index 3457c2bde6b..af8dd853c6c 100644
--- a/vespalib/src/tests/priority_queue/priority_queue_test.cpp
+++ b/vespalib/src/tests/priority_queue/priority_queue_test.cpp
@@ -154,11 +154,11 @@ TEST("require that priority queue works with move-only objects") {
struct MyItem {
int value;
int *ref;
- MyItem(int v, int &r) : value(v), ref(&r) {}
- MyItem(const MyItem &) = delete;
- MyItem &operator=(const MyItem &) = delete;
- MyItem(MyItem &&rhs) : value(rhs.value), ref(rhs.ref) { rhs.ref = 0; }
- MyItem &operator=(MyItem &&rhs) {
+ MyItem(int v, int &r) noexcept : value(v), ref(&r) {}
+ MyItem(const MyItem &) noexcept = delete;
+ MyItem &operator=(const MyItem &) noexcept = delete;
+ MyItem(MyItem &&rhs) noexcept : value(rhs.value), ref(rhs.ref) { rhs.ref = 0; }
+ MyItem &operator=(MyItem &&rhs) noexcept {
value = rhs.value;
ref = rhs.ref;
rhs.ref = 0;
diff --git a/vespalib/src/tests/stllike/hash_test.cpp b/vespalib/src/tests/stllike/hash_test.cpp
index e86a9ad020a..d6f5c2ba65d 100644
--- a/vespalib/src/tests/stllike/hash_test.cpp
+++ b/vespalib/src/tests/stllike/hash_test.cpp
@@ -15,14 +15,14 @@ namespace {
struct Foo {
int i;
- Foo() : i(0) {}
- Foo(int i_) : i(i_) {}
+ Foo() noexcept : i(0) {}
+ Foo(int i_) noexcept : i(i_) {}
- bool operator==(const Foo& f) const
+ bool operator==(const Foo& f) const noexcept
{ return (i == f.i); }
struct hash {
- size_t operator() (const Foo& f) const {
+ size_t operator() (const Foo& f) const noexcept {
return (f.i % 16);
}
};
@@ -332,10 +332,10 @@ TEST("test hash map with simple key and value type")
class S {
public:
- explicit S(uint64_t l=0) : _a(l&0xfffffffful), _b(l>>32) { }
+ explicit S(uint64_t l=0) noexcept : _a(l&0xfffffffful), _b(l>>32) { }
uint32_t hash() const { return _a; }
uint32_t a() const { return _a; }
- friend bool operator == (const S & a, const S & b) { return a._a == b._a && a._b == b._b; }
+ friend bool operator == (const S & a, const S & b) noexcept { return a._a == b._a && a._b == b._b; }
private:
uint32_t _a, _b;
};
diff --git a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
index 72a0c93c719..faee7680426 100644
--- a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
+++ b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
@@ -71,13 +71,13 @@ class Gid
{
public:
struct hash {
- size_t operator () (const Gid & g) const { return g.getGid()[0]; }
+ size_t operator () (const Gid & g) const noexcept { return g.getGid()[0]; }
};
- Gid(unsigned int v=0) : _gid() { _gid[0] = _gid[1] = _gid[2] = v; }
+ Gid(unsigned int v=0) noexcept : _gid() { _gid[0] = _gid[1] = _gid[2] = v; }
const unsigned int * getGid() const { return _gid; }
- int cmp(const Gid & b) const { return memcmp(_gid, b._gid, sizeof(_gid)); }
- bool operator < (const Gid & b) const { return cmp(b) < 0; }
- bool operator == (const Gid & b) const { return cmp(b) == 0; }
+ int cmp(const Gid & b) const noexcept { return memcmp(_gid, b._gid, sizeof(_gid)); }
+ bool operator < (const Gid & b) const noexcept { return cmp(b) < 0; }
+ bool operator == (const Gid & b) const noexcept { return cmp(b) == 0; }
private:
unsigned int _gid[3];
};
@@ -85,15 +85,15 @@ private:
class Slot
{
public:
- Slot(unsigned int v=0) : _gid(v) { }
+ Slot(unsigned int v=0) noexcept : _gid(v) { }
const Gid & getGid() const { return _gid; }
- int cmp(const Slot & b) const { return _gid.cmp(b.getGid()); }
+ int cmp(const Slot & b) const noexcept { return _gid.cmp(b.getGid()); }
private:
Gid _gid;
};
struct IndirectCmp : public std::binary_function<Slot*, Slot*, bool> {
- bool operator()(const Slot* s1, const Slot* s2) {
+ bool operator() (const Slot* s1, const Slot* s2) noexcept {
return s1->cmp(*s2) < 0;
}
};
diff --git a/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp b/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp
index a61f9fb5bca..2c1463e506a 100644
--- a/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp
+++ b/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp
@@ -15,7 +15,7 @@ struct WorkContext
{
uint64_t _generation;
- WorkContext()
+ WorkContext() noexcept
: _generation(0)
{
}