From ed7e36e133e8e214e40526af15fefcaf20694427 Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Wed, 28 Aug 2024 15:50:44 +0200 Subject: [PATCH] Improve function calling coverage. --- test/usecases/function/non_threadsafe.mod | 18 +++++---- .../function/point_non_threadsafe.mod | 38 +++++++++++++++++++ test/usecases/function/test_functions.py | 2 + 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 test/usecases/function/point_non_threadsafe.mod diff --git a/test/usecases/function/non_threadsafe.mod b/test/usecases/function/non_threadsafe.mod index adf92e2ba..8c8405642 100644 --- a/test/usecases/function/non_threadsafe.mod +++ b/test/usecases/function/non_threadsafe.mod @@ -10,14 +10,6 @@ ASSIGNED { x } -STATE { - z -} - -LINEAR lin { - ~ z = 2 -} - FUNCTION x_plus_a(a) { x_plus_a = x + a } @@ -34,3 +26,13 @@ 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/point_non_threadsafe.mod b/test/usecases/function/point_non_threadsafe.mod new file mode 100644 index 000000000..27326822e --- /dev/null +++ b/test/usecases/function/point_non_threadsafe.mod @@ -0,0 +1,38 @@ +NEURON { + POINT_PROCESS point_non_threadsafe + RANGE x + GLOBAL gbl +} + +ASSIGNED { + gbl + v + x +} + +FUNCTION x_plus_a(a) { + x_plus_a = x + a +} + +FUNCTION v_plus_a(a) { + v_plus_a = v + 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 a34ff75b8..6936fe29e 100644 --- a/test/usecases/function/test_functions.py +++ b/test/usecases/function/test_functions.py @@ -36,7 +36,9 @@ def check_callable(get_instance): values = [0.1 + k for k in range(nseg)] 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} 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])