Skip to content

Commit

Permalink
Python support: some work on coverage testing SimulationData (#2178).
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Dec 11, 2019
1 parent cb20f42 commit a19099d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Expand Up @@ -110,6 +110,12 @@
- Test value properly set: yes
- Test SimulationData.algebraic():
- Size: 0
- Starting point: 0.000000
- Test Starting point properly set: yes
- Ending point: 50.000000
- Test Ending point properly set: yes
- Point interval: 0.001000
- Test Point interval properly set: yes

---------------------------------------
SimulationResults coverage tests
Expand Down
17 changes: 17 additions & 0 deletions src/plugins/support/PythonSupport/tests/data/coveragetests.py
Expand Up @@ -19,6 +19,19 @@ def test_data_store_values(values, name, indent=''):
print('%s - Test value properly set: %s' % (indent, "yes" if value.value() == test_value else "no"))


def test_simulation_data_property(get_method, set_method, description):
orig_value = get_method()
test_value = 123.456789

print(' - %s: %f' % (description, orig_value))

set_method(test_value)

print(' - Test %s properly set: %s' % (description, "yes" if get_method() == test_value else "no"))

set_method(orig_value)


def test_data_store_variable_index(variable, index, indent):
print('%s - value(%d): %f' % (indent, index, variable.value(index)))

Expand Down Expand Up @@ -100,6 +113,10 @@ def test_data_store_variables(variables, name, indent=''):
test_data_store_values(data.rates(), 'SimulationData.rates()')
test_data_store_values(data.algebraic(), 'SimulationData.algebraic()')

test_simulation_data_property(data.starting_point, data.set_starting_point, 'Starting point')
test_simulation_data_property(data.ending_point, data.set_ending_point, 'Ending point')
test_simulation_data_property(data.point_interval, data.set_point_interval, 'Point interval')

# Coverage tests for SimulationResults

header('SimulationResults coverage tests', False)
Expand Down

0 comments on commit a19099d

Please sign in to comment.