Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 5e39e77

Browse files
PaoloPenazzilm98
authored andcommitted
test: fix test exports
1 parent e9f906f commit 5e39e77

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/core/lang/execution.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,25 @@ mod test {
128128
exports
129129
}
130130

131+
#[test]
132+
fn foldhood_alignment() {
133+
// Export of device 2: Export(/ -> "1", FoldHood(0) -> "1", FoldHood(0) / Nbr(0) -> 4)
134+
let export_dev_2 = export!((path!(), 1), (path!(FoldHood(0)), 1), (path!(Nbr(0), FoldHood(0)), 4));
135+
// Export of device 4: Export(/ -> "3", FoldHood(0) -> "3")
136+
let export_dev_4 = export!((path!(), 3), (path!(FoldHood(0)), 3));
137+
let mut exports: HashMap<i32, Export> = HashMap::new();
138+
exports.insert(2, export_dev_2);
139+
exports.insert(4, export_dev_4);
140+
let context = Context::new(0, Default::default(), Default::default(), exports);
141+
// Program: foldhood(-5)(_ + _)(nbr(2))
142+
let program = |vm| foldhood(vm,
143+
|| -5,
144+
| a, b| (a + b),
145+
|vm1| nbr(vm1, |vm2| (vm2, 2)));
146+
let result = round(init_with_ctx(context), program);
147+
assert_eq!(-4, result.1);
148+
}
149+
131150
#[test]
132151
fn test_foldhood() {
133152
let context = Context::new(0, Default::default(), Default::default(), create_export_foldhood_test());

0 commit comments

Comments
 (0)