diff options
Diffstat (limited to 'tests/unit_tests')
-rw-r--r-- | tests/unit_tests/crypto.cpp | 8 | ||||
-rw-r--r-- | tests/unit_tests/ringdb.cpp | 8 | ||||
-rw-r--r-- | tests/unit_tests/serialization.cpp | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/tests/unit_tests/crypto.cpp b/tests/unit_tests/crypto.cpp index 4bed06173..9e1680568 100644 --- a/tests/unit_tests/crypto.cpp +++ b/tests/unit_tests/crypto.cpp @@ -73,3 +73,11 @@ TEST(Crypto, Ostream) EXPECT_TRUE(is_formatted<crypto::key_derivation>()); EXPECT_TRUE(is_formatted<crypto::key_image>()); } + +TEST(Crypto, null_keys) +{ + char zero[32]; + memset(zero, 0, 32); + ASSERT_EQ(memcmp(crypto::null_skey.data, zero, 32), 0); + ASSERT_EQ(memcmp(crypto::null_pkey.data, zero, 32), 0); +} diff --git a/tests/unit_tests/ringdb.cpp b/tests/unit_tests/ringdb.cpp index 10e6c46c9..8b0ea10d4 100644 --- a/tests/unit_tests/ringdb.cpp +++ b/tests/unit_tests/ringdb.cpp @@ -80,13 +80,13 @@ public: private: std::string make_filename() { - boost::filesystem::path path = tools::get_default_data_dir(); - path /= "fake"; + boost::filesystem::path path = + boost::filesystem::temp_directory_path(); #if defined(__MINGW32__) || defined(__MINGW__) - filename = tempnam(path.string().c_str(), "ringdb-test-"); + filename = tempnam(path.string().c_str(), "monero-ringdb-test-"); EXPECT_TRUE(filename != NULL); #else - path /= "ringdb-test-XXXXXX"; + path /= "monero-ringdb-test-XXXXXX"; filename = strdup(path.string().c_str()); EXPECT_TRUE(mkdtemp(filename) != NULL); #endif diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp index 5a2114027..40616059a 100644 --- a/tests/unit_tests/serialization.cpp +++ b/tests/unit_tests/serialization.cpp @@ -810,7 +810,7 @@ TEST(Serialization, portability_outputs) if(ciphertext.size() < prefix_size) return {}; crypto::chacha_key key; - crypto::generate_chacha_key(&skey, sizeof(skey), key); + crypto::generate_chacha_key(&skey, sizeof(skey), key, 1); const crypto::chacha_iv &iv = *(const crypto::chacha_iv*)&ciphertext[0]; std::string plaintext; plaintext.resize(ciphertext.size() - prefix_size); |