Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
indexed_tree.test.cpp File Reference
#include "indexed_tree.hpp"
#include "../array_store.hpp"
#include "../hash.hpp"
#include "../nullifier_tree/nullifier_memory_tree.hpp"
#include "barretenberg/common/streams.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/numeric/random/engine.hpp"
#include "leaves_cache.hpp"

Go to the source code of this file.

Typedefs

using HashPolicy = Poseidon2HashPolicy
 

Functions

 TEST (stdlib_indexed_tree, can_create)
 
 TEST (stdlib_indexed_tree, test_size)
 
 TEST (stdlib_indexed_tree, test_get_hash_path)
 
 TEST (stdlib_indexed_tree, test_batch_insert)
 
fr hash_leaf (const indexed_leaf &leaf)
 
bool check_hash_path (const fr &root, const fr_hash_path &path, const indexed_leaf &leaf_value, const size_t idx)
 
 TEST (stdlib_indexed_tree, test_indexed_memory)
 
 TEST (stdlib_indexed_tree, test_indexed_tree)
 

Variables

const size_t NUM_VALUES = 1024
 

Typedef Documentation

◆ HashPolicy

Definition at line 13 of file indexed_tree.test.cpp.

Function Documentation

◆ check_hash_path()

bool check_hash_path ( const fr root,
const fr_hash_path path,
const indexed_leaf &  leaf_value,
const size_t  idx 
)

Definition at line 139 of file indexed_tree.test.cpp.

◆ hash_leaf()

fr hash_leaf ( const indexed_leaf &  leaf)

Definition at line 134 of file indexed_tree.test.cpp.

◆ TEST() [1/6]

TEST ( stdlib_indexed_tree  ,
can_create   
)

Definition at line 29 of file indexed_tree.test.cpp.

◆ TEST() [2/6]

TEST ( stdlib_indexed_tree  ,
test_batch_insert   
)

Definition at line 84 of file indexed_tree.test.cpp.

◆ TEST() [3/6]

TEST ( stdlib_indexed_tree  ,
test_get_hash_path   
)

Definition at line 60 of file indexed_tree.test.cpp.

◆ TEST() [4/6]

TEST ( stdlib_indexed_tree  ,
test_indexed_memory   
)

Intial state:

index 0 1 2 3 4 5 6 7

val 0 0 0 0 0 0 0 0 nextIdx 0 0 0 0 0 0 0 0 nextVal 0 0 0 0 0 0 0 0

Add new value 30:

index 0 1 2 3 4 5 6 7

val 0 30 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 30 0 0 0 0 0 0 0

Add new value 10:

index 0 1 2 3 4 5 6 7

val 0 30 10 0 0 0 0 0 nextIdx 2 0 1 0 0 0 0 0 nextVal 10 0 30 0 0 0 0 0

Add new value 20:

index 0 1 2 3 4 5 6 7

val 0 30 10 20 0 0 0 0 nextIdx 2 0 3 1 0 0 0 0 nextVal 10 0 20 30 0 0 0 0

Add new value 50:

index 0 1 2 3 4 5 6 7

val 0 30 10 20 50 0 0 0 nextIdx 2 4 3 1 0 0 0 0 nextVal 10 50 20 30 0 0 0 0

Definition at line 153 of file indexed_tree.test.cpp.

◆ TEST() [5/6]

TEST ( stdlib_indexed_tree  ,
test_indexed_tree   
)

Definition at line 291 of file indexed_tree.test.cpp.

◆ TEST() [6/6]

TEST ( stdlib_indexed_tree  ,
test_size   
)

Definition at line 39 of file indexed_tree.test.cpp.

Variable Documentation

◆ NUM_VALUES

const size_t NUM_VALUES = 1024

Definition at line 20 of file indexed_tree.test.cpp.