Fix test cases

This commit is contained in:
Sebastian Messmer 2015-10-27 23:19:11 +01:00
parent 7b269a1184
commit 1f86f83ca1
4 changed files with 8 additions and 8 deletions

View File

@ -2,9 +2,7 @@
#include "../../../crypto/kdf/DerivedKey.h"
#include "../../../data/DataFixture.h"
using namespace cryfs;
using cpputils::DataFixture;
using cpputils::Data;
using namespace cpputils;
TEST(DerivedKeyTest, Config) {
DerivedKey<32> key(DerivedKeyConfig(DataFixture::generate(32, 1), 1024, 8, 16), DataFixture::generateFixedSize<32>(2));

View File

@ -2,7 +2,7 @@
#include "../../../crypto/kdf/Scrypt.h"
#include "testutils/SCryptTestSettings.h"
using namespace cryfs;
using namespace cpputils;
TEST(SCryptTest, GeneratedKeyIsReproductible_448) {
auto created = SCrypt().generateKey<56, SCryptTestSettings>("mypassword");

View File

@ -14,7 +14,7 @@ using namespace cpputils;
class FixedSizeDataTest: public Test {
public:
static constexpr unsigned int SIZE = 16;
static constexpr size_t SIZE = 16;
const string DATA1_AS_STRING = "1491BB4932A389EE14BC7090AC772972";
const string DATA2_AS_STRING = "272EE5517627CFA147A971A8E6E747E0";
@ -24,14 +24,14 @@ public:
FixedSizeDataTest() : DATA3_AS_BINARY(DataFixture::generate(SIZE, 1)), DATA4_AS_BINARY(DataFixture::generate(SIZE, 2)) {}
template<unsigned int SIZE>
template<size_t SIZE>
void EXPECT_DATA_EQ(const Data &expected, const FixedSizeData<SIZE> &actual) {
EXPECT_EQ(expected.size(), SIZE);
EXPECT_EQ(0, std::memcmp(expected.data(), actual.data(), SIZE));
}
};
constexpr unsigned int FixedSizeDataTest::SIZE;
constexpr size_t FixedSizeDataTest::SIZE;
TEST_F(FixedSizeDataTest, EqualsTrue) {
FixedSizeData<SIZE> DATA1_1 = FixedSizeData<SIZE>::FromString(DATA1_AS_STRING);

View File

@ -68,9 +68,11 @@ void logAndExit(const string &message) {
exit(1);
}
using LoggingTest_DeathTest = LoggingTest;
// fork() only forks the main thread. This test ensures that logging doesn't depend on threads that suddenly aren't
// there anymore after a fork().
TEST_F(LoggingTest, LoggingAlsoWorksAfterFork) {
TEST_F(LoggingTest_DeathTest, LoggingAlsoWorksAfterFork) {
setLogger(spdlog::stderr_logger_mt("StderrLogger"));
EXPECT_EXIT(
logAndExit("My log message"),