Refactor directory layout to allow other modules in same repository
This commit is contained in:
parent
11e1b89e31
commit
92cf6fa66d
@ -1,5 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
include(utils.cmake)
|
||||
|
||||
add_subdirectory(vendor)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
||||
|
@ -1,101 +1 @@
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
###################################################
|
||||
# Activate C++14
|
||||
#
|
||||
# Uses: ACTIVATE_CPP14()
|
||||
###################################################
|
||||
macro(ACTIVATE_CPP14)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_HAS_CPP14_SUPPORT)
|
||||
IF (COMPILER_HAS_CPP14_SUPPORT)
|
||||
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC -std=c++14)
|
||||
ELSE()
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++1y" COMPILER_HAS_CPP14_PARTIAL_SUPPORT)
|
||||
IF (COMPILER_HAS_CPP14_PARTIAL_SUPPORT)
|
||||
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC -std=c++1y)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Compiler doesn't support C++14")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC -stdlib=libc++)
|
||||
ENDIF()
|
||||
endmacro(ACTIVATE_CPP14)
|
||||
|
||||
#################################################
|
||||
# Enable style compiler warnings
|
||||
#################################################
|
||||
macro(ENABLE_STYLE_WARNINGS)
|
||||
# TARGET_COMPILE_OPTIONS(${BII_BLOCK_TARGET} INTERFACE -Wall -Wextra -Weffc++)
|
||||
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE -Wall -Wextra)
|
||||
endmacro(ENABLE_STYLE_WARNINGS)
|
||||
|
||||
##################################################
|
||||
# Add boost to the project
|
||||
#
|
||||
# Uses:
|
||||
# ADD_BOOST() # if you're only using header-only boost libs
|
||||
# ADD_BOOST(system filesystem) # list all libraries to link against in the dependencies
|
||||
##################################################
|
||||
function(ADD_BOOST)
|
||||
# Load boost libraries
|
||||
find_package(Boost 1.56.0
|
||||
REQUIRED
|
||||
COMPONENTS ${ARGN})
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES})
|
||||
endfunction()
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project (cpp-utils)
|
||||
|
||||
set(SOURCES
|
||||
crypto/symmetric/ciphers.cpp
|
||||
crypto/kdf/DerivedKey.cpp
|
||||
crypto/kdf/Scrypt.cpp
|
||||
crypto/kdf/DerivedKeyConfig.cpp
|
||||
crypto/RandomPadding.cpp
|
||||
process/daemonize.cpp
|
||||
process/subprocess.cpp
|
||||
tempfile/TempFile.cpp
|
||||
tempfile/TempDir.cpp
|
||||
network/HttpClient.cpp
|
||||
network/CurlHttpClient.cpp
|
||||
network/FakeHttpClient.cpp
|
||||
io/Console.cpp
|
||||
io/pipestream.cpp
|
||||
thread/LoopThread.cpp
|
||||
thread/ThreadSystem.cpp
|
||||
random/Random.cpp
|
||||
random/RandomGeneratorThread.cpp
|
||||
random/OSRandomGenerator.cpp
|
||||
random/PseudoRandomPool.cpp
|
||||
random/RandomDataBuffer.cpp
|
||||
random/RandomGenerator.cpp
|
||||
lock/LockPool.cpp
|
||||
data/Serializer.cpp
|
||||
data/Deserializer.cpp
|
||||
data/DataFixture.cpp
|
||||
data/DataUtils.cpp
|
||||
data/Data.cpp
|
||||
assert/backtrace.cpp
|
||||
assert/AssertFailed.cpp
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
||||
|
||||
# This is needed by boost thread
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rt)
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE curl)
|
||||
|
||||
# TODO From Crypto++ 5.7 on, it should support cmake with find_package().
|
||||
find_library(CryptoPP cryptopp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${CryptoPP} scrypt)
|
||||
|
||||
ADD_BOOST(filesystem system thread)
|
||||
ENABLE_STYLE_WARNINGS()
|
||||
ACTIVATE_CPP14()
|
||||
add_subdirectory(cpp-utils)
|
||||
|
53
src/cpp-utils/CMakeLists.txt
Normal file
53
src/cpp-utils/CMakeLists.txt
Normal file
@ -0,0 +1,53 @@
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
project (cpp-utils)
|
||||
|
||||
set(SOURCES
|
||||
crypto/symmetric/ciphers.cpp
|
||||
crypto/kdf/DerivedKey.cpp
|
||||
crypto/kdf/Scrypt.cpp
|
||||
crypto/kdf/DerivedKeyConfig.cpp
|
||||
crypto/RandomPadding.cpp
|
||||
process/daemonize.cpp
|
||||
process/subprocess.cpp
|
||||
tempfile/TempFile.cpp
|
||||
tempfile/TempDir.cpp
|
||||
network/HttpClient.cpp
|
||||
network/CurlHttpClient.cpp
|
||||
network/FakeHttpClient.cpp
|
||||
io/Console.cpp
|
||||
io/pipestream.cpp
|
||||
thread/LoopThread.cpp
|
||||
thread/ThreadSystem.cpp
|
||||
random/Random.cpp
|
||||
random/RandomGeneratorThread.cpp
|
||||
random/OSRandomGenerator.cpp
|
||||
random/PseudoRandomPool.cpp
|
||||
random/RandomDataBuffer.cpp
|
||||
random/RandomGenerator.cpp
|
||||
lock/LockPool.cpp
|
||||
data/Serializer.cpp
|
||||
data/Deserializer.cpp
|
||||
data/DataFixture.cpp
|
||||
data/DataUtils.cpp
|
||||
data/Data.cpp
|
||||
assert/backtrace.cpp
|
||||
assert/AssertFailed.cpp
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
||||
|
||||
# This is needed by boost thread
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE rt)
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE curl)
|
||||
|
||||
# TODO From Crypto++ 5.7 on, it should support cmake with find_package().
|
||||
find_library(CryptoPP cryptopp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${CryptoPP} scrypt)
|
||||
|
||||
add_boost(${PROJECT_NAME} filesystem system thread)
|
||||
enable_style_warnings(${PROJECT_NAME})
|
||||
activate_cpp14(${PROJECT_NAME})
|
@ -5,7 +5,7 @@
|
||||
#include "../../macros.h"
|
||||
#include "../../random/Random.h"
|
||||
extern "C" {
|
||||
#include "../../../vendor/scrypt-1.2.0/lib/crypto/crypto_scrypt.h"
|
||||
#include "../../../../vendor/scrypt-1.2.0/lib/crypto/crypto_scrypt.h"
|
||||
}
|
||||
#include <stdexcept>
|
||||
#include "DerivedKey.h"
|
@ -2,7 +2,7 @@
|
||||
#ifndef MESSMER_CPPUTILS_LOGGING_LOGGER_H
|
||||
#define MESSMER_CPPUTILS_LOGGING_LOGGER_H
|
||||
|
||||
#include "../../vendor/spdlog/spdlog.h"
|
||||
#include "../../../vendor/spdlog/spdlog.h"
|
||||
#include "../macros.h"
|
||||
|
||||
namespace cpputils {
|
@ -1,60 +1,5 @@
|
||||
project (cpp-utils-test)
|
||||
|
||||
set(SOURCES
|
||||
EitherIncludeTest.cpp
|
||||
crypto/symmetric/CipherTest.cpp
|
||||
crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp
|
||||
crypto/kdf/SCryptTest.cpp
|
||||
crypto/kdf/DerivedKeyTest.cpp
|
||||
crypto/kdf/DerivedKeyConfigTest.cpp
|
||||
MacrosIncludeTest.cpp
|
||||
pointer/unique_ref_test.cpp
|
||||
pointer/cast_include_test.cpp
|
||||
pointer/cast_test.cpp
|
||||
pointer/unique_ref_boost_optional_gtest_workaround_include_test.cpp
|
||||
pointer/optional_ownership_ptr_include_test.cpp
|
||||
pointer/optional_ownership_ptr_test.cpp
|
||||
pointer/unique_ref_include_test.cpp
|
||||
process/daemonize_include_test.cpp
|
||||
process/subprocess_include_test.cpp
|
||||
tempfile/TempFileTest.cpp
|
||||
tempfile/TempFileIncludeTest.cpp
|
||||
tempfile/TempDirIncludeTest.cpp
|
||||
tempfile/TempDirTest.cpp
|
||||
network/CurlHttpClientTest.cpp
|
||||
network/FakeHttpClientTest.cpp
|
||||
io/ConsoleIncludeTest.cpp
|
||||
io/ConsoleTest_AskYesNo.cpp
|
||||
io/ConsoleTest_Print.cpp
|
||||
io/ConsoleTest_Ask.cpp
|
||||
random/RandomIncludeTest.cpp
|
||||
lock/LockPoolIncludeTest.cpp
|
||||
lock/ConditionBarrierIncludeTest.cpp
|
||||
lock/MutexPoolLockIncludeTest.cpp
|
||||
data/FixedSizeDataTest.cpp
|
||||
data/DataFixtureIncludeTest.cpp
|
||||
data/DataFixtureTest.cpp
|
||||
data/DataTest.cpp
|
||||
data/FixedSizeDataIncludeTest.cpp
|
||||
data/DataIncludeTest.cpp
|
||||
logging/LoggingLevelTest.cpp
|
||||
logging/LoggerTest.cpp
|
||||
logging/LoggingTest.cpp
|
||||
logging/LoggerIncludeTest.cpp
|
||||
logging/LoggingIncludeTest.cpp
|
||||
EitherTest.cpp
|
||||
assert/assert_release_test.cpp
|
||||
assert/backtrace_include_test.cpp
|
||||
assert/assert_include_test.cpp
|
||||
assert/assert_debug_test.cpp
|
||||
)
|
||||
|
||||
enable_testing()
|
||||
include_directories(${PROJECT_NAME} SYSTEM ${gtest_INCLUDE_DIRS}/include SYSTEM ${gmock_INCLUDE_DIRS}/include)
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} gtest gmock gmock_main)
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
include_directories(SYSTEM ${gtest_INCLUDE_DIRS}/include SYSTEM ${gmock_INCLUDE_DIRS}/include)
|
||||
link_libraries(gtest gmock gmock_main)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} cpp-utils)
|
||||
enable_style_warnings()
|
||||
activate_cpp14()
|
||||
add_subdirectory(cpp-utils)
|
57
test/cpp-utils/CMakeLists.txt
Normal file
57
test/cpp-utils/CMakeLists.txt
Normal file
@ -0,0 +1,57 @@
|
||||
project (cpp-utils-test)
|
||||
|
||||
set(SOURCES
|
||||
EitherIncludeTest.cpp
|
||||
crypto/symmetric/CipherTest.cpp
|
||||
crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp
|
||||
crypto/kdf/SCryptTest.cpp
|
||||
crypto/kdf/DerivedKeyTest.cpp
|
||||
crypto/kdf/DerivedKeyConfigTest.cpp
|
||||
MacrosIncludeTest.cpp
|
||||
pointer/unique_ref_test.cpp
|
||||
pointer/cast_include_test.cpp
|
||||
pointer/cast_test.cpp
|
||||
pointer/unique_ref_boost_optional_gtest_workaround_include_test.cpp
|
||||
pointer/optional_ownership_ptr_include_test.cpp
|
||||
pointer/optional_ownership_ptr_test.cpp
|
||||
pointer/unique_ref_include_test.cpp
|
||||
process/daemonize_include_test.cpp
|
||||
process/subprocess_include_test.cpp
|
||||
tempfile/TempFileTest.cpp
|
||||
tempfile/TempFileIncludeTest.cpp
|
||||
tempfile/TempDirIncludeTest.cpp
|
||||
tempfile/TempDirTest.cpp
|
||||
network/CurlHttpClientTest.cpp
|
||||
network/FakeHttpClientTest.cpp
|
||||
io/ConsoleIncludeTest.cpp
|
||||
io/ConsoleTest_AskYesNo.cpp
|
||||
io/ConsoleTest_Print.cpp
|
||||
io/ConsoleTest_Ask.cpp
|
||||
random/RandomIncludeTest.cpp
|
||||
lock/LockPoolIncludeTest.cpp
|
||||
lock/ConditionBarrierIncludeTest.cpp
|
||||
lock/MutexPoolLockIncludeTest.cpp
|
||||
data/FixedSizeDataTest.cpp
|
||||
data/DataFixtureIncludeTest.cpp
|
||||
data/DataFixtureTest.cpp
|
||||
data/DataTest.cpp
|
||||
data/FixedSizeDataIncludeTest.cpp
|
||||
data/DataIncludeTest.cpp
|
||||
logging/LoggingLevelTest.cpp
|
||||
logging/LoggerTest.cpp
|
||||
logging/LoggingTest.cpp
|
||||
logging/LoggerIncludeTest.cpp
|
||||
logging/LoggingIncludeTest.cpp
|
||||
EitherTest.cpp
|
||||
assert/assert_release_test.cpp
|
||||
assert/backtrace_include_test.cpp
|
||||
assert/assert_include_test.cpp
|
||||
assert/assert_debug_test.cpp
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} cpp-utils)
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
|
||||
enable_style_warnings(${PROJECT_NAME})
|
||||
activate_cpp14(${PROJECT_NAME})
|
@ -1,3 +1,3 @@
|
||||
#include "../src/either.h"
|
||||
#include "../../src/cpp-utils/either.h"
|
||||
|
||||
//Test that either can be included without needing additional dependencies
|
@ -1,8 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
#include "../src/either.h"
|
||||
#include "../src/macros.h"
|
||||
#include "../../src/cpp-utils/either.h"
|
||||
#include "../../src/cpp-utils/macros.h"
|
||||
#include <sstream>
|
||||
|
||||
//TODO Go through all test cases and think about whether it makes sense to add the same test case but with primitive types.
|
@ -1,3 +1,3 @@
|
||||
#include "../src/macros.h"
|
||||
#include "../../src/cpp-utils/macros.h"
|
||||
|
||||
// Test that macros.h can be included without needing additional dependencies
|
@ -3,7 +3,7 @@
|
||||
|
||||
//Include the ASSERT macro for a debug build
|
||||
#undef NDEBUG
|
||||
#include "../../src/assert/assert.h"
|
||||
#include "../../../src/cpp-utils/assert/assert.h"
|
||||
|
||||
using testing::MatchesRegex;
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include "../../src/assert/assert.h"
|
||||
#include "../../../src/cpp-utils/assert/assert.h"
|
||||
|
||||
// Test the header can be included without needing additional dependencies
|
@ -3,7 +3,7 @@
|
||||
|
||||
//Include the ASSERT macro for a release build
|
||||
#define NDEBUG
|
||||
#include "../../src/assert/assert.h"
|
||||
#include "../../../src/cpp-utils/assert/assert.h"
|
||||
|
||||
using testing::MatchesRegex;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "../../src/assert/backtrace.h"
|
||||
#include "../../../src/cpp-utils/assert/backtrace.h"
|
||||
|
||||
// Test the header can be included without needing additional dependencies
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "../../../src/crypto/kdf/DerivedKeyConfig.h"
|
||||
#include "../../../src/data/DataFixture.h"
|
||||
#include "../../../../src/cpp-utils/crypto/kdf/DerivedKeyConfig.h"
|
||||
#include "../../../../src/cpp-utils/data/DataFixture.h"
|
||||
#include <sstream>
|
||||
|
||||
using namespace cpputils;
|
||||
@ -35,52 +35,52 @@ TEST_F(DerivedKeyConfigTest, Salt_SaveAndLoad) {
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, N) {
|
||||
DerivedKeyConfig cfg(Data(0), 1024, 0, 0);
|
||||
EXPECT_EQ(1024, cfg.N());
|
||||
EXPECT_EQ(1024u, cfg.N());
|
||||
}
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, N_Move) {
|
||||
DerivedKeyConfig cfg(Data(0), 1024, 0, 0);
|
||||
DerivedKeyConfig moved = std::move(cfg);
|
||||
EXPECT_EQ(1024, moved.N());
|
||||
EXPECT_EQ(1024u, moved.N());
|
||||
}
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, N_SaveAndLoad) {
|
||||
DerivedKeyConfig cfg(Data(0), 1024, 0, 0);
|
||||
DerivedKeyConfig loaded = SaveAndLoad(cfg);
|
||||
EXPECT_EQ(1024, loaded.N());
|
||||
EXPECT_EQ(1024u, loaded.N());
|
||||
}
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, r) {
|
||||
DerivedKeyConfig cfg(Data(0), 0, 8, 0);
|
||||
EXPECT_EQ(8, cfg.r());
|
||||
EXPECT_EQ(8u, cfg.r());
|
||||
}
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, r_Move) {
|
||||
DerivedKeyConfig cfg(Data(0), 0, 8, 0);
|
||||
DerivedKeyConfig moved = std::move(cfg);
|
||||
EXPECT_EQ(8, moved.r());
|
||||
EXPECT_EQ(8u, moved.r());
|
||||
}
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, r_SaveAndLoad) {
|
||||
DerivedKeyConfig cfg(Data(0), 0, 8, 0);
|
||||
DerivedKeyConfig loaded = SaveAndLoad(cfg);
|
||||
EXPECT_EQ(8, loaded.r());
|
||||
EXPECT_EQ(8u, loaded.r());
|
||||
}
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, p) {
|
||||
DerivedKeyConfig cfg(Data(0), 0, 0, 16);
|
||||
EXPECT_EQ(16, cfg.p());
|
||||
EXPECT_EQ(16u, cfg.p());
|
||||
}
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, p_Move) {
|
||||
DerivedKeyConfig cfg(Data(0), 0, 0, 16);
|
||||
DerivedKeyConfig moved = std::move(cfg);
|
||||
EXPECT_EQ(16, moved.p());
|
||||
EXPECT_EQ(16u, moved.p());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(DerivedKeyConfigTest, p_SaveAndLoad) {
|
||||
DerivedKeyConfig cfg(Data(0), 0, 0, 16);
|
||||
DerivedKeyConfig loaded = SaveAndLoad(cfg);
|
||||
EXPECT_EQ(16, loaded.p());
|
||||
EXPECT_EQ(16u, loaded.p());
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "../../../src/crypto/kdf/DerivedKey.h"
|
||||
#include "../../../src/data/DataFixture.h"
|
||||
#include "../../../../src/cpp-utils/crypto/kdf/DerivedKey.h"
|
||||
#include "../../../../src/cpp-utils/data/DataFixture.h"
|
||||
|
||||
using namespace cpputils;
|
||||
|
||||
TEST(DerivedKeyTest, Config) {
|
||||
DerivedKey<32> key(DerivedKeyConfig(DataFixture::generate(32, 1), 1024, 8, 16), DataFixture::generateFixedSize<32>(2));
|
||||
EXPECT_EQ(DataFixture::generate(32, 1), key.config().salt());
|
||||
EXPECT_EQ(1024, key.config().N());
|
||||
EXPECT_EQ(8, key.config().r());
|
||||
EXPECT_EQ(16, key.config().p());
|
||||
EXPECT_EQ(1024u, key.config().N());
|
||||
EXPECT_EQ(8u, key.config().r());
|
||||
EXPECT_EQ(16u, key.config().p());
|
||||
}
|
||||
|
||||
TEST(DerivedKeyTest, Key) {
|
@ -1,5 +1,5 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "../../../src/crypto/kdf/Scrypt.h"
|
||||
#include "../../../../src/cpp-utils/crypto/kdf/Scrypt.h"
|
||||
|
||||
using namespace cpputils;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "../../../src/crypto/symmetric/Cipher.h"
|
||||
#include "../../../src/crypto/symmetric/ciphers.h"
|
||||
#include "../../../../src/cpp-utils/crypto/symmetric/Cipher.h"
|
||||
#include "../../../../src/cpp-utils/crypto/symmetric/ciphers.h"
|
||||
#include "testutils/FakeAuthenticatedCipher.h"
|
||||
|
||||
#include "../../../src/data/DataFixture.h"
|
||||
#include "../../../src/data/Data.h"
|
||||
#include "../../../../src/cpp-utils/data/DataFixture.h"
|
||||
#include "../../../../src/cpp-utils/data/Data.h"
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
|
||||
using namespace cpputils;
|
@ -2,10 +2,10 @@
|
||||
#ifndef MESSMER_CPPUTILS_TEST_CRYPTO_SYMMETRIC_TESTUTILS_FAKEAUTHENTICATEDCIPHER_H_
|
||||
#define MESSMER_CPPUTILS_TEST_CRYPTO_SYMMETRIC_TESTUTILS_FAKEAUTHENTICATEDCIPHER_H_
|
||||
|
||||
#include "../../../../src/crypto/symmetric/Cipher.h"
|
||||
#include "../../../../src/data/FixedSizeData.h"
|
||||
#include "../../../../src/data/Data.h"
|
||||
#include "../../../../src/random/RandomGenerator.h"
|
||||
#include "../../../../../src/cpp-utils/crypto/symmetric/Cipher.h"
|
||||
#include "../../../../../src/cpp-utils/data/FixedSizeData.h"
|
||||
#include "../../../../../src/cpp-utils/data/Data.h"
|
||||
#include "../../../../../src/cpp-utils/random/RandomGenerator.h"
|
||||
|
||||
namespace cpputils {
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include "../../src/data/DataFixture.h"
|
||||
#include "../../../src/cpp-utils/data/DataFixture.h"
|
||||
|
||||
// Test the header can be included without needing additional dependencies
|
@ -1,7 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../../src/data/Data.h"
|
||||
#include "../../src/data/DataFixture.h"
|
||||
#include "../../../src/cpp-utils/data/Data.h"
|
||||
#include "../../../src/cpp-utils/data/DataFixture.h"
|
||||
|
||||
using ::testing::Test;
|
||||
using ::testing::WithParamInterface;
|
||||
@ -16,17 +16,17 @@ class DataFixtureTest: public Test {
|
||||
|
||||
TEST_F(DataFixtureTest, CreateEmptyFixture) {
|
||||
Data data = DataFixture::generate(0);
|
||||
EXPECT_EQ(0, data.size());
|
||||
EXPECT_EQ(0u, data.size());
|
||||
}
|
||||
|
||||
TEST_F(DataFixtureTest, CreateOneByteFixture) {
|
||||
Data data = DataFixture::generate(1);
|
||||
EXPECT_EQ(1, data.size());
|
||||
EXPECT_EQ(1u, data.size());
|
||||
}
|
||||
|
||||
TEST_F(DataFixtureTest, CreateLargerFixture) {
|
||||
Data data = DataFixture::generate(20 * 1024 * 1024);
|
||||
EXPECT_EQ(20 * 1024 * 1024, data.size());
|
||||
EXPECT_EQ(20u * 1024u * 1024u, data.size());
|
||||
}
|
||||
|
||||
TEST_F(DataFixtureTest, FixturesAreDeterministic_DefaultSeed) {
|
@ -1,3 +1,3 @@
|
||||
#include "../../src/data/Data.h"
|
||||
#include "../../../src/cpp-utils/data/Data.h"
|
||||
|
||||
// Test the header can be included without needing additional dependencies
|
@ -1,8 +1,8 @@
|
||||
#include "../../src/data/DataFixture.h"
|
||||
#include "../../src/data/Data.h"
|
||||
#include "../../../src/cpp-utils/data/DataFixture.h"
|
||||
#include "../../../src/cpp-utils/data/Data.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../../src/tempfile/TempFile.h"
|
||||
#include "../../../src/cpp-utils/tempfile/TempFile.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@ -141,7 +141,7 @@ TEST_F(DataTest, MoveConstructor) {
|
||||
Data copy(std::move(original));
|
||||
EXPECT_EQ(DataFixture::generate(1024), copy);
|
||||
EXPECT_EQ(nullptr, original.data());
|
||||
EXPECT_EQ(0, original.size());
|
||||
EXPECT_EQ(0u, original.size());
|
||||
}
|
||||
|
||||
TEST_F(DataTest, MoveAssignment) {
|
||||
@ -150,7 +150,7 @@ TEST_F(DataTest, MoveAssignment) {
|
||||
copy = std::move(original);
|
||||
EXPECT_EQ(DataFixture::generate(1024), copy);
|
||||
EXPECT_EQ(nullptr, original.data());
|
||||
EXPECT_EQ(0, original.size());
|
||||
EXPECT_EQ(0u, original.size());
|
||||
}
|
||||
|
||||
TEST_F(DataTest, Equality) {
|
@ -1,3 +1,3 @@
|
||||
#include "../../src/data/FixedSizeData.h"
|
||||
#include "../../../src/cpp-utils/data/FixedSizeData.h"
|
||||
|
||||
// Test the header can be included without needing additional dependencies
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user