diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-08-08 22:18:28 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-08-08 22:18:28 +0200 |
commit | 851d4fb9db087eeb183f1c1cb5d96829a32e690b (patch) | |
tree | b7bcefc108ed310b6568cb10f728233833209ccc /test/option.cc | |
parent | 005cd3b630fcf0f3870f426a0db5e54400a59ef9 (diff) | |
download | cpp-utils-851d4fb9db087eeb183f1c1cb5d96829a32e690b.tar.gz cpp-utils-851d4fb9db087eeb183f1c1cb5d96829a32e690b.zip |
add clang-tidy and fix lints
Diffstat (limited to 'test/option.cc')
-rw-r--r-- | test/option.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/test/option.cc b/test/option.cc index 0417266..30b2406 100644 --- a/test/option.cc +++ b/test/option.cc @@ -2,31 +2,31 @@ #include <cstdio> #include <cstdlib> -struct Checker { +struct checker { static unsigned cnt; - Checker() { + checker() { ++cnt; } - Checker(const Checker&) { + checker(const checker&) { ++cnt; } - Checker(Checker&&) { + checker(checker&&) noexcept { ++cnt; } - ~Checker() { + ~checker() { --cnt; } }; -unsigned Checker::cnt = 0; +unsigned checker::cnt = 0; int main() { using option::option; auto check_cnt = [](unsigned expect) { - if (expect != Checker::cnt) { - std::printf("Checker: expect=%u cnt=%u\n", expect, Checker::cnt); + if (expect != checker::cnt) { + std::printf("Checker: expect=%u cnt=%u\n", expect, checker::cnt); std::abort(); } }; @@ -43,18 +43,18 @@ int main() { check_cnt(0); { - option<Checker> o1(Checker{}); + option<checker> o1(checker{}); // copy construct - option<Checker> o2 = o1; + option<checker> o2 = o1; // move construct - option<Checker> o3 = o1.take(); + option<checker> o3 = o1.take(); assert(!o1.has_value()); assert(o2.has_value()); assert(o3.has_value()); // move option - option<Checker> o4 = std::move(o2); + option<checker> o4 = std::move(o2); assert(!o2.has_value()); assert(o4.has_value()); @@ -74,7 +74,7 @@ int main() { check_cnt(0); { - option<Checker> o1; + option<checker> o1; assert(!o1.has_value()); o1.emplace(); |