Replace boost::array with std::array
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
#include "zcash/NoteEncryption.hpp"
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
extern ZCJoinSplit* params;
|
||||
@@ -38,25 +40,25 @@ void test_full_api(ZCJoinSplit* js)
|
||||
uint64_t vpub_old = 10;
|
||||
uint64_t vpub_new = 0;
|
||||
uint256 pubKeyHash = random_uint256();
|
||||
boost::array<uint256, 2> macs;
|
||||
boost::array<uint256, 2> nullifiers;
|
||||
boost::array<uint256, 2> commitments;
|
||||
std::array<uint256, 2> macs;
|
||||
std::array<uint256, 2> nullifiers;
|
||||
std::array<uint256, 2> commitments;
|
||||
uint256 rt = tree.root();
|
||||
boost::array<ZCNoteEncryption::Ciphertext, 2> ciphertexts;
|
||||
std::array<ZCNoteEncryption::Ciphertext, 2> ciphertexts;
|
||||
SproutProof proof;
|
||||
|
||||
{
|
||||
boost::array<JSInput, 2> inputs = {
|
||||
std::array<JSInput, 2> inputs = {
|
||||
JSInput(), // dummy input
|
||||
JSInput() // dummy input
|
||||
};
|
||||
|
||||
boost::array<JSOutput, 2> outputs = {
|
||||
std::array<JSOutput, 2> outputs = {
|
||||
JSOutput(recipient_addr, 10),
|
||||
JSOutput() // dummy output
|
||||
};
|
||||
|
||||
boost::array<SproutNote, 2> output_notes;
|
||||
std::array<SproutNote, 2> output_notes;
|
||||
|
||||
// Perform the proof
|
||||
proof = js->prove(
|
||||
@@ -121,7 +123,7 @@ void test_full_api(ZCJoinSplit* js)
|
||||
pubKeyHash = random_uint256();
|
||||
|
||||
{
|
||||
boost::array<JSInput, 2> inputs = {
|
||||
std::array<JSInput, 2> inputs = {
|
||||
JSInput(), // dummy input
|
||||
JSInput(witness_recipient, decrypted_note, recipient_key)
|
||||
};
|
||||
@@ -129,12 +131,12 @@ void test_full_api(ZCJoinSplit* js)
|
||||
SproutSpendingKey second_recipient = SproutSpendingKey::random();
|
||||
SproutPaymentAddress second_addr = second_recipient.address();
|
||||
|
||||
boost::array<JSOutput, 2> outputs = {
|
||||
std::array<JSOutput, 2> outputs = {
|
||||
JSOutput(second_addr, 9),
|
||||
JSOutput() // dummy output
|
||||
};
|
||||
|
||||
boost::array<SproutNote, 2> output_notes;
|
||||
std::array<SproutNote, 2> output_notes;
|
||||
|
||||
// Perform the proof
|
||||
proof = js->prove(
|
||||
@@ -176,8 +178,8 @@ void test_full_api(ZCJoinSplit* js)
|
||||
// to test exceptions
|
||||
void invokeAPI(
|
||||
ZCJoinSplit* js,
|
||||
const boost::array<JSInput, 2>& inputs,
|
||||
const boost::array<JSOutput, 2>& outputs,
|
||||
const std::array<JSInput, 2>& inputs,
|
||||
const std::array<JSOutput, 2>& outputs,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new,
|
||||
const uint256& rt
|
||||
@@ -185,12 +187,12 @@ void invokeAPI(
|
||||
uint256 ephemeralKey;
|
||||
uint256 randomSeed;
|
||||
uint256 pubKeyHash = random_uint256();
|
||||
boost::array<uint256, 2> macs;
|
||||
boost::array<uint256, 2> nullifiers;
|
||||
boost::array<uint256, 2> commitments;
|
||||
boost::array<ZCNoteEncryption::Ciphertext, 2> ciphertexts;
|
||||
std::array<uint256, 2> macs;
|
||||
std::array<uint256, 2> nullifiers;
|
||||
std::array<uint256, 2> commitments;
|
||||
std::array<ZCNoteEncryption::Ciphertext, 2> ciphertexts;
|
||||
|
||||
boost::array<SproutNote, 2> output_notes;
|
||||
std::array<SproutNote, 2> output_notes;
|
||||
|
||||
SproutProof proof = js->prove(
|
||||
false,
|
||||
@@ -213,8 +215,8 @@ void invokeAPI(
|
||||
|
||||
void invokeAPIFailure(
|
||||
ZCJoinSplit* js,
|
||||
const boost::array<JSInput, 2>& inputs,
|
||||
const boost::array<JSOutput, 2>& outputs,
|
||||
const std::array<JSInput, 2>& inputs,
|
||||
const std::array<JSOutput, 2>& outputs,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new,
|
||||
const uint256& rt,
|
||||
@@ -540,7 +542,7 @@ TEST(joinsplit, note_plaintexts)
|
||||
random_uint256()
|
||||
);
|
||||
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> memo;
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo;
|
||||
|
||||
SproutNotePlaintext note_pt(note, memo);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "sodium.h"
|
||||
|
||||
#include <array>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "zcash/NoteEncryption.hpp"
|
||||
@@ -29,7 +30,7 @@ TEST(noteencryption, api)
|
||||
ASSERT_TRUE(b.get_epk() != c.get_epk());
|
||||
}
|
||||
|
||||
boost::array<unsigned char, ZC_NOTEPLAINTEXT_SIZE> message;
|
||||
std::array<unsigned char, ZC_NOTEPLAINTEXT_SIZE> message;
|
||||
for (size_t i = 0; i < ZC_NOTEPLAINTEXT_SIZE; i++) {
|
||||
// Fill the message with dummy data
|
||||
message[i] = (unsigned char) i;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "zcash/Address.hpp"
|
||||
#include "wallet/wallet.h"
|
||||
#include "amount.h"
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <set>
|
||||
@@ -167,7 +169,7 @@ TEST(paymentdisclosure, mainnet) {
|
||||
}
|
||||
|
||||
// Convert signature buffer to boost array
|
||||
boost::array<unsigned char, 64> arrayPayloadSig;
|
||||
std::array<unsigned char, 64> arrayPayloadSig;
|
||||
memcpy(arrayPayloadSig.data(), &payloadSig[0], 64);
|
||||
|
||||
// Payment disclosure blob to pass around
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "zcash/Note.hpp"
|
||||
#include "zcash/Address.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
extern ZCJoinSplit* params;
|
||||
extern int GenZero(int n);
|
||||
extern int GenMax(int n);
|
||||
@@ -30,16 +32,16 @@ TEST(Transaction, JSDescriptionRandomized) {
|
||||
|
||||
// create JSDescription
|
||||
uint256 pubKeyHash;
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
|
||||
std::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
|
||||
libzcash::JSInput(witness, note, k),
|
||||
libzcash::JSInput() // dummy input of zero value
|
||||
};
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs = {
|
||||
std::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs = {
|
||||
libzcash::JSOutput(addr, 50),
|
||||
libzcash::JSOutput(addr, 50)
|
||||
};
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
|
||||
{
|
||||
auto jsdesc = JSDescription::Randomized(
|
||||
@@ -66,8 +68,8 @@ TEST(Transaction, JSDescriptionRandomized) {
|
||||
inputMap, outputMap,
|
||||
0, 0, false, nullptr, GenZero);
|
||||
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0};
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0};
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
|
||||
EXPECT_EQ(expectedInputMap, inputMap);
|
||||
EXPECT_EQ(expectedOutputMap, outputMap);
|
||||
}
|
||||
@@ -80,8 +82,8 @@ TEST(Transaction, JSDescriptionRandomized) {
|
||||
inputMap, outputMap,
|
||||
0, 0, false, nullptr, GenMax);
|
||||
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1};
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1};
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
|
||||
EXPECT_EQ(expectedInputMap, inputMap);
|
||||
EXPECT_EQ(expectedOutputMap, outputMap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user