Skip to content

Commit

Permalink
Tests for locals.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Oct 30, 2024
1 parent 81ceeeb commit 5768faa
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/usecases/verbatim/locals.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
NEURON {
SUFFIX locals
}

PARAMETER {
a = -1.0
}

FUNCTION get_a() { LOCAL a
a = 32.0
VERBATIM
_lget_a = _la;
ENDVERBATIM
}

FUNCTION get_b() { LOCAL a, b
a = -1.0
b = 32.0
{ LOCAL a
a = 100.0
b = b + a
VERBATIM
_lget_b = _lb;
ENDVERBATIM
}
}
12 changes: 12 additions & 0 deletions test/usecases/verbatim/test_locals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from neuron import h, gui

def test_locals():
s = h.Section()
s.insert("locals")

assert s(0.5).locals.get_a() == 32.0
assert s(0.5).locals.get_b() == 132.0


if __name__ == "__main__":
test_locals()

0 comments on commit 5768faa

Please sign in to comment.