Skip to content

Commit

Permalink
Improve function calling coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Sep 3, 2024
1 parent e73c75e commit 176f2e5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/usecases/function/non_threadsafe.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ ASSIGNED {
x
}

STATE {
z
}

LINEAR lin {
~ z = 2
}

FUNCTION x_plus_a(a) {
x_plus_a = x + a
}
Expand All @@ -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
}

38 changes: 38 additions & 0 deletions test/usecases/function/point_non_threadsafe.mod
Original file line number Diff line number Diff line change
@@ -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
}

2 changes: 2 additions & 0 deletions test/usecases/function/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

0 comments on commit 176f2e5

Please sign in to comment.