29 #include <sys/types.h> 34 #include <boost/filesystem.hpp> 36 #include "gtest/gtest.h" 46 static crypto::chacha_key generate_chacha_key()
48 crypto::chacha_key chacha_key;
49 uint64_t password = crypto::rand<uint64_t>();
50 crypto::generate_chacha_key(
std::string((
const char*)&password,
sizeof(password)), chacha_key, 1);
62 static std::pair<uint64_t, uint64_t> generate_output()
64 return std::make_pair(
rand(),
rand());
68 static const crypto::chacha_key KEY_1 = generate_chacha_key();
69 static const crypto::chacha_key KEY_2 = generate_chacha_key();
71 static const std::pair<uint64_t, uint64_t> OUTPUT_1 = generate_output();
72 static const std::pair<uint64_t, uint64_t> OUTPUT_2 = generate_output();
78 ~RingDB() {
close(); boost::filesystem::remove_all(filename); free(filename); }
83 boost::filesystem::path path =
84 boost::filesystem::temp_directory_path();
85 #if defined(__MINGW32__) || defined(__MINGW__) 86 filename = tempnam(path.string().c_str(),
"electroneum-ringdb-test-");
89 path /=
"electroneum-ringdb-test-XXXXXX";
90 filename = strdup(path.string().c_str());
103 std::vector<uint64_t> outs;
110 std::vector<uint64_t> outs, outs2;
111 outs.push_back(43); outs.push_back(7320); outs.push_back(8429);
120 std::vector<uint64_t> outs, outs2;
121 outs.push_back(43); outs.push_back(7320); outs.push_back(8429);
130 TEST(ringdb, different_genesis)
133 std::vector<uint64_t> outs, outs2;
134 outs.push_back(43); outs.push_back(7320); outs.push_back(8429);
156 std::vector<std::pair<uint64_t, uint64_t>> outputs;
157 outputs.push_back(std::make_pair(0, 1));
158 outputs.push_back(std::make_pair(10, 3));
159 outputs.push_back(std::make_pair(10, 4));
160 outputs.push_back(std::make_pair(10, 8));
161 outputs.push_back(std::make_pair(20, 0));
162 outputs.push_back(std::make_pair(20, 1));
163 outputs.push_back(std::make_pair(30, 5));
177 TEST(spent_outputs, mark_as_unspent)
std::vector< std::string > keypair
#define EXPECT_TRUE(condition)
#define ASSERT_FALSE(condition)
RingDB(const char *genesis="")
#define ASSERT_EQ(val1, val2)
void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image)
void rand(size_t N, uint8_t *bytes)
device & get_device(const std::string &device_descriptor)
unsigned __int64 uint64_t
static keypair generate(hw::device &hwdev)
#define ASSERT_TRUE(condition)