Ran clang-format across all files
This commit is contained in:
1 parent
a27321df2e
commit
8f21a77150
1123 files changed
+159414
-162346
No files matched your search
@@ -3,28 +3,28 @@
|
||||
#include <thread>
|
||||
|
||||
namespace bts {
|
||||
|
||||
|
||||
struct Chunk {
|
||||
size_t a,b,c,d;
|
||||
size_t a, b, c, d;
|
||||
};
|
||||
|
||||
TEST_CASE("ConcurrentAppendCollection", "[collection]") {
|
||||
SECTION("SEQUENTIAL") {
|
||||
ConcurrentAppendCollection<size_t,5> intvec;
|
||||
ConcurrentAppendCollection<Chunk,5> chunkvec;
|
||||
ConcurrentAppendCollection<size_t, 5> intvec;
|
||||
ConcurrentAppendCollection<Chunk, 5> chunkvec;
|
||||
// Insert 9999 elements
|
||||
for (size_t x=0; x< 9999; ++x) {
|
||||
for (size_t x = 0; x < 9999; ++x) {
|
||||
intvec.push_back(x);
|
||||
chunkvec.push_back({ x,x,x,x });
|
||||
chunkvec.push_back({x, x, x, x});
|
||||
}
|
||||
size_t expected = 0;
|
||||
for(const auto& i : intvec) {
|
||||
for (const auto &i : intvec) {
|
||||
REQUIRE(i == expected);
|
||||
++expected;
|
||||
}
|
||||
REQUIRE(expected == 9999);
|
||||
expected = 0;
|
||||
for(const auto& i : chunkvec) {
|
||||
for (const auto &i : chunkvec) {
|
||||
REQUIRE(i.a == expected);
|
||||
REQUIRE(i.b == expected);
|
||||
REQUIRE(i.c == expected);
|
||||
@@ -32,7 +32,7 @@ TEST_CASE("ConcurrentAppendCollection", "[collection]") {
|
||||
++expected;
|
||||
}
|
||||
REQUIRE(expected == 9999);
|
||||
for (size_t x=0; x< 9999; ++x) {
|
||||
for (size_t x = 0; x < 9999; ++x) {
|
||||
REQUIRE(intvec[x] == x);
|
||||
REQUIRE(chunkvec[x].a == x);
|
||||
REQUIRE(chunkvec[x].b == x);
|
||||
@@ -63,7 +63,7 @@ TEST_CASE("ConcurrentAppendCollection", "[collection]") {
|
||||
for (size_t a = 0; a < OUTTER; ++a) {
|
||||
for (size_t b = 0; b < INNER; ++b) {
|
||||
auto x = 1000 * a + b;
|
||||
chunkvec.push_back({x,x,x,x});
|
||||
chunkvec.push_back({x, x, x, x});
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
@@ -74,10 +74,11 @@ TEST_CASE("ConcurrentAppendCollection", "[collection]") {
|
||||
// read until we have read a million elements
|
||||
size_t goal = OUTTER * INNER;
|
||||
size_t count = 0;
|
||||
while(count != goal) {
|
||||
while (count != goal) {
|
||||
count = 0;
|
||||
for (const auto& item : chunkvec) {
|
||||
// If theses tests are wrong it may be that item is partially constructed
|
||||
for (const auto &item : chunkvec) {
|
||||
// If theses tests are wrong it may be that item is partially
|
||||
// constructed
|
||||
REQUIRE(item.a == item.d);
|
||||
REQUIRE(item.c == item.d);
|
||||
REQUIRE(item.b == item.c);
|
||||
@@ -88,10 +89,10 @@ TEST_CASE("ConcurrentAppendCollection", "[collection]") {
|
||||
}));
|
||||
}
|
||||
writer.join();
|
||||
for (auto& thread : readers) {
|
||||
for (auto &thread : readers) {
|
||||
thread.join();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}//ns
|
||||
} // namespace bts
|
||||
Reference in new issue
Block a user