Skip to content

Commit

Permalink
Test premature segfaulting.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Oct 21, 2024
1 parent e0cb8fc commit ccd84e3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/usecases/global/test_without_instance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from neuron import h, gui


def make_accessors(mech_name):
get = getattr(h, f"get_gbl_{mech_name}")
set = getattr(h, f"set_gbl_{mech_name}")

return get, set


def check_write_read_cycle(mech_name):
get, set = make_accessors(mech_name)

expected = 278.045
set(expected)

actual = get()
assert (
actual == expected
), f"{actual = }, {expected = }, delta = {actual - expected}"


def test_top_local():
check_write_read_cycle("top_local")


if __name__ == "__main__":
test_top_local()
8 changes: 8 additions & 0 deletions test/usecases/global/top_local.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ BREAKPOINT {
y = gbl
il = 0.0000001 * (v - 10.0)
}

FUNCTION get_gbl() {
get_gbl = gbl
}

PROCEDURE set_gbl(value) {
gbl = value
}

0 comments on commit ccd84e3

Please sign in to comment.