Skip to content

Commit

Permalink
chore: add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Feb 9, 2024
1 parent d21217e commit 1cd82f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test_programs/execution_success/global_consts/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ struct Test {
global VALS: [Test; 1] = [Test { v: 100 }];
global NESTED = [VALS, VALS];

unconstrained fn calculate_global_value() -> Field {
42
}

// Regression test for https://github.com/noir-lang/noir/issues/4318
global CALCULATED_GLOBAL: Field = calculate_global_value();

fn main(
a: [Field; M + N - N],
b: [Field; 30 + N / 2],
Expand Down Expand Up @@ -74,6 +81,8 @@ fn main(
foo::from_foo(d);
baz::from_baz(c);
assert(DERIVED == M + L);

assert(CALCULATED_GLOBAL == 42);
}

fn multiplyByM(x: Field) -> Field {
Expand Down

0 comments on commit 1cd82f0

Please sign in to comment.