Skip to content

Commit

Permalink
WIP on a test
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jan 8, 2025
1 parent eee837d commit 0cf2d10
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions noir-projects/aztec-nr/aztec/src/macros/storage/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use std::{collections::umap::UHashMap, hash::{BuildHasherDefault, poseidon2::Pos
use super::utils::get_serialized_size;
use super::utils::is_note;

/// Stores a map from a module to the name of the struct that describes its storage layout.
/// This is then used when generating a `storage_layout()` getter on the contract struct.
pub comptime mut global STORAGE_LAYOUT_NAME: UHashMap<Module, Quoted, BuildHasherDefault<Poseidon2Hasher>> =
UHashMap::default();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ type = "contract"
[dependencies]
aztec = { path = "../../../aztec-nr/aztec" }
value_note = { path = "../../../aztec-nr/value-note" }
uint_note = { path = "../../../aztec-nr/uint-note" }
token_portal_content_hash_lib = { path = "../token_portal_content_hash_lib" }
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod test;
mod test_note;

// A contract used for testing a random hodgepodge of small features from simulator and end-to-end tests.
Expand Down Expand Up @@ -42,6 +43,10 @@ contract Test {
use std::meta::derive;

use crate::test_note::TestNote;

// Imported just to test note type ids
use dep::uint_note::uint_note::UintNote;

#[derive(Serialize)]
#[event]
struct ExampleEvent {
Expand Down
14 changes: 7 additions & 7 deletions noir-projects/noir-contracts/contracts/test_contract/src/test.nr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::{ValueNote_737700206_EXPORTS};
use crate::test_note::TestNote;
use dep::uint_note::uint_note::UintNote;
use dep::value_note::value_note::ValueNote;

#[test]
unconstrained fn test_note_type_id() {
let expected_value_note_type_id = 0;

// TODO(benesjan): too tired to finish today

assert_eq(ValueNote_737700206_EXPORTS[0])
}
assert_eq(UintNote::get_note_type_id(), 0, "UintNote type id should be 0");
assert_eq(ValueNote::get_note_type_id(), 1, "ValueNote type id should be 1");
assert_eq(TestNote::get_note_type_id(), 2, "TestNote type id should be 2");
}

0 comments on commit 0cf2d10

Please sign in to comment.