Skip to content

Commit

Permalink
Clang tidy fixess and cmake simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
wwiv committed Sep 16, 2019
1 parent d5c760d commit 8f989c2
Show file tree
Hide file tree
Showing 26 changed files with 21 additions and 43 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project(wwiv)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

include_directories(${CMAKE_SOURCE_DIR})

include(Common)
include(FindASan)

Expand Down
1 change: 0 additions & 1 deletion bbs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV
include_directories(..)
include_directories(../deps/cl342)
include_directories(../deps/cereal/include)
Include(FindWWIVCurses)
Expand Down
3 changes: 1 addition & 2 deletions bbs_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

include_directories(../deps/googletest/googletest/include)
include_directories(..)
include_directories(${GTEST_INCLUDE_DIRS})
include_directories(../deps/cereal/include)

set(test_sources
Expand Down
1 change: 0 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV
include_directories(..)

set(COMMON_SOURCES
clock.cpp
Expand Down
3 changes: 1 addition & 2 deletions core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_directories(../deps/googletest/googletest/include)
include_directories(..)
include_directories(${GTEST_INCLUDE_DIRS})

set(fixture_sources
file_helper.cpp
Expand Down
8 changes: 4 additions & 4 deletions core_test/clock_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ using std::vector;

using namespace wwiv::core;

TEST(Clock, Simple) {
auto start = DateTime::now();
TEST(Clock, Simple) {
const auto start = DateTime::now();

SystemClock c{};
auto mid = c.Now();
const auto mid = c.Now();

auto end = DateTime::now();
const auto end = DateTime::now();

EXPECT_GE(mid, start);
EXPECT_LE(mid, end);
Expand Down
10 changes: 5 additions & 5 deletions core_test/file_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <filesystem>

/**
* Helper class for tests requing local filesystem access.
* Helper class for tests requiring local filesystem access.
*
* Note: This class can not use File since it is used by the tests for File.
*/
Expand All @@ -35,17 +35,17 @@ class FileHelper {
// Returns a fully qualified path name to "name" under the temporary directory.
// This will end with a pathSeparator and is suitable for use
// in wwiv datastructures.
const std::string DirName(const std::string& name) const;
[[nodiscard]] const std::string DirName(const std::string& name) const;
// Returns a fully qualified path to "name" under the temporary directory.
// This is suitable for use in constructing paths
const std::filesystem::path Dir(const std::string& name) const;
[[nodiscard]] const std::filesystem::path Dir(const std::string& name) const;
// Creates a directory under TempDir.
bool Mkdir(const std::string& name) const;
std::filesystem::path CreateTempFilePath(const std::string& name);
std::tuple<FILE*, std::filesystem::path> OpenTempFile(const std::string& name);
std::filesystem::path CreateTempFile(const std::string& name, const std::string& contents);
const std::filesystem::path& TempDir() const { return tmp_; }
const std::string ReadFile(const std::filesystem::path& name) const;
[[nodiscard]] const std::filesystem::path& TempDir() const { return tmp_; }
[[nodiscard]] const std::string ReadFile(const std::filesystem::path& name) const;
static void set_wwiv_test_tempdir(const std::string& d) noexcept;

private:
Expand Down
9 changes: 4 additions & 5 deletions core_test/log_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "core/log.h"

#include <map>
#include <iostream>
#include <string>
#include <vector>

Expand All @@ -33,7 +32,7 @@ using namespace wwiv::core;
class TestAppender : public Appender {
public:
TestAppender() : Appender() {}
virtual bool append(const std::string& message) const {
bool append(const std::string& message) override {
log_lines.push_back(message);
return true;
}
Expand All @@ -43,7 +42,7 @@ class TestAppender : public Appender {

class LogTest : public ::testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Clear all of the loggers
info = std::make_shared<TestAppender>();
warning = std::make_shared<TestAppender>();
Expand All @@ -52,11 +51,11 @@ class LogTest : public ::testing::Test {
Logger::config().add_appender(LoggerLevel::warning, warning);

timestamp.assign("2018-01-01 21:12:00,530 ");
timestamp_fn fn = [this]() { return timestamp; };
const auto fn = [this]() { return timestamp; };
Logger::config().timestamp_fn_ = fn;
}

virtual void TearDown() { Logger::config().reset(); }
void TearDown() override { Logger::config().reset(); }

std::shared_ptr<TestAppender> info;
std::shared_ptr<TestAppender> warning;
Expand Down
1 change: 0 additions & 1 deletion local_io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV
include_directories(..)
Include(FindWWIVCurses)

set(COMMON_SOURCES
Expand Down
1 change: 0 additions & 1 deletion localui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)
Include(FindWWIVCurses)

set(COMMON_SOURCES
Expand Down
1 change: 0 additions & 1 deletion net_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(SOURCES
net_cmdline.cpp
Expand Down
3 changes: 1 addition & 2 deletions net_core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
enable_testing()

include_directories(../deps/googletest/googletest/include)
include_directories(..)
include_directories(${GTEST_INCLUDE_DIRS})

set(test_sources
net_cmdline_test.cpp
Expand Down
1 change: 0 additions & 1 deletion network/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(NETWORK_MAIN network.cpp)

Expand Down
1 change: 0 additions & 1 deletion network1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(NETWORK_MAIN network1.cpp)

Expand Down
1 change: 0 additions & 1 deletion network2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(NETWORK_MAIN
network2.cpp
Expand Down
1 change: 0 additions & 1 deletion network3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(NETWORK_MAIN network3.cpp)

Expand Down
1 change: 0 additions & 1 deletion networkb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(NETWORKB_MAIN networkb.cpp)

Expand Down
3 changes: 1 addition & 2 deletions networkb_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
enable_testing()

include_directories(../deps/googletest/googletest/include)
include_directories(..)
include_directories(${GTEST_INCLUDE_DIRS})

set(test_sources
binkp_test.cpp
Expand Down
1 change: 0 additions & 1 deletion networkc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(NETWORK_MAIN networkc.cpp)

Expand Down
1 change: 0 additions & 1 deletion networkf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(NETWORK_MAIN networkf.cpp)

Expand Down
1 change: 0 additions & 1 deletion sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include_directories(..)
include_directories(../deps/cereal/include)

set(COMMON_SOURCES
Expand Down
3 changes: 1 addition & 2 deletions sdk_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_directories(../deps/googletest/googletest/include)
include_directories(..)
include_directories(${GTEST_INCLUDE_DIRS})

set(test_sources
callout_test.cpp
Expand Down
1 change: 0 additions & 1 deletion wwivconfig/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)
Include(FindWWIVCurses)


Expand Down
1 change: 0 additions & 1 deletion wwivd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV Daemon
include_directories(..)
include_directories(../deps/cereal/include)

set(WWIVD_SOURCES
Expand Down
4 changes: 1 addition & 3 deletions wwivd_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
include_directories(../deps/googletest/googletest/include)
include_directories(..)

include_directories(${GTEST_INCLUDE_DIRS})

set(test_sources
wwivd_non_http_test.cpp
Expand Down
1 change: 0 additions & 1 deletion wwivutil/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CMake for WWIV 5
include_directories(..)

set(WWIVUTIL_MAIN wwivutil.cpp)

Expand Down

0 comments on commit 8f989c2

Please sign in to comment.