mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
Updated clang-format
Merged with origin
This commit is contained in:
@@ -3,15 +3,13 @@
|
||||
|
||||
using q_type = spdlog::details::circular_q<size_t>;
|
||||
|
||||
TEST_CASE("test_size", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_size", "[circular_q]") {
|
||||
const size_t q_size = 4;
|
||||
q_type q(q_size);
|
||||
REQUIRE(q.size() == 0);
|
||||
REQUIRE(q.empty() == true);
|
||||
REQUIRE(q.full() == false);
|
||||
for (size_t i = 0; i < q_size; i++)
|
||||
{
|
||||
for (size_t i = 0; i < q_size; i++) {
|
||||
q.push_back(10);
|
||||
}
|
||||
REQUIRE(q.size() == q_size);
|
||||
@@ -19,13 +17,11 @@ TEST_CASE("test_size", "[circular_q]")
|
||||
REQUIRE(q.size() == q_size);
|
||||
}
|
||||
|
||||
TEST_CASE("test_rolling", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_rolling", "[circular_q]") {
|
||||
const size_t q_size = 4;
|
||||
q_type q(q_size);
|
||||
|
||||
for (size_t i = 0; i < q_size + 2; i++)
|
||||
{
|
||||
for (size_t i = 0; i < q_size + 2; i++) {
|
||||
auto val = i;
|
||||
q.push_back(std::move(val)); // arg to push_back must be r value
|
||||
}
|
||||
@@ -50,8 +46,7 @@ TEST_CASE("test_rolling", "[circular_q]")
|
||||
REQUIRE(q.front() == 6);
|
||||
}
|
||||
|
||||
TEST_CASE("test_empty", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_empty", "[circular_q]") {
|
||||
q_type q1(0);
|
||||
REQUIRE(q1.empty());
|
||||
REQUIRE(q1.full()); // q with capacity 0 is considered full
|
||||
@@ -66,8 +61,7 @@ TEST_CASE("test_empty", "[circular_q]")
|
||||
REQUIRE(q2.empty());
|
||||
}
|
||||
|
||||
TEST_CASE("test_full", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_full", "[circular_q]") {
|
||||
q_type q1(0);
|
||||
REQUIRE(q1.full());
|
||||
|
||||
@@ -81,8 +75,7 @@ TEST_CASE("test_full", "[circular_q]")
|
||||
REQUIRE(q2.full());
|
||||
}
|
||||
|
||||
TEST_CASE("test_operator[]", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_operator[]", "[circular_q]") {
|
||||
q_type q(2);
|
||||
q.push_back(100);
|
||||
q.push_back(200);
|
||||
@@ -90,8 +83,7 @@ TEST_CASE("test_operator[]", "[circular_q]")
|
||||
REQUIRE(q[1] == 200);
|
||||
}
|
||||
|
||||
TEST_CASE("test_operator=", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_operator=", "[circular_q]") {
|
||||
q_type q1(2);
|
||||
q1.push_back(100);
|
||||
q1.push_back(200);
|
||||
@@ -101,20 +93,17 @@ TEST_CASE("test_operator=", "[circular_q]")
|
||||
REQUIRE(q2[1] == 200);
|
||||
}
|
||||
|
||||
TEST_CASE("test_front", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_front", "[circular_q]") {
|
||||
q_type q(2);
|
||||
q.push_back(100);
|
||||
q.push_back(200);
|
||||
REQUIRE(q.front() == 100);
|
||||
}
|
||||
|
||||
TEST_CASE("test_overrun_counter", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_overrun_counter", "[circular_q]") {
|
||||
q_type q(2);
|
||||
REQUIRE(q.overrun_counter() == 0);
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
{
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
q.push_back(100);
|
||||
}
|
||||
REQUIRE(q.overrun_counter() == 8);
|
||||
@@ -123,8 +112,7 @@ TEST_CASE("test_overrun_counter", "[circular_q]")
|
||||
REQUIRE(q.overrun_counter() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("test_move", "[circular_q]")
|
||||
{
|
||||
TEST_CASE("test_move", "[circular_q]") {
|
||||
q_type q1(2);
|
||||
q1.push_back(100);
|
||||
q1.push_back(200);
|
||||
|
Reference in New Issue
Block a user