diff --git a/test/usecases/function/artificial_functions.mod b/test/usecases/function/artificial_functions.mod new file mode 100644 index 000000000..a6d574fde --- /dev/null +++ b/test/usecases/function/artificial_functions.mod @@ -0,0 +1,34 @@ +NEURON { + ARTIFICIAL_CELL art_functions + RANGE x + GLOBAL gbl +} + +ASSIGNED { + gbl + v + x +} + +FUNCTION x_plus_a(a) { + x_plus_a = x + a +} + +FUNCTION identity(v) { + identity = v +} + +INITIAL { + x = 1.0 + gbl = 42.0 +} + +: A LINEAR block makes a MOD file not VECTORIZED. +STATE { + z +} + +LINEAR lin { + ~ z = 2 +} + diff --git a/test/usecases/function/test_functions.py b/test/usecases/function/test_functions.py index 6936fe29e..046cb8555 100644 --- a/test/usecases/function/test_functions.py +++ b/test/usecases/function/test_functions.py @@ -1,7 +1,7 @@ from neuron import h -def check_callable(get_instance): +def check_callable(get_instance, has_voltage=True): for x, value in zip(coords, values): get_instance(x).x = value @@ -19,10 +19,11 @@ def check_callable(get_instance): actual = get_instance(x).identity(expected) assert actual == expected, f"{actual} == {expected}" - # Check `f` using `v`. - expected = -2.0 - actual = get_instance(x).v_plus_a(40.0) - assert actual == expected, f"{actual} == {expected}" + if has_voltage: + # Check `f` using `v`. + expected = -2.0 + actual = get_instance(x).v_plus_a(40.0) + assert actual == expected, f"{actual} == {expected}" nseg = 5 @@ -38,7 +39,10 @@ def check_callable(get_instance): point_processes = {x: h.point_functions(s(x)) for x in coords} point_non_threadsafe = {x: h.point_non_threadsafe(s(x)) for x in coords} +art_cells = {x: h.art_functions() for x in coords} + check_callable(lambda x: s(x).functions) check_callable(lambda x: s(x).non_threadsafe) check_callable(lambda x: point_processes[x]) check_callable(lambda x: point_non_threadsafe[x]) +check_callable(lambda x: art_cells[x], has_voltage=False)