Added basic unit tests of non-integrated functions
This commit is contained in:
parent
f54684b460
commit
5137d1b9dc
7 changed files with 228 additions and 46 deletions
59
tests/test_extension_scan.py
Normal file
59
tests/test_extension_scan.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from pprint import pprint
|
||||
|
||||
from openflexure_microscope.api.default_extensions import scan
|
||||
|
||||
|
||||
def test_construct_grid_raster():
|
||||
grid = scan.construct_grid((0, 0), (100, 100), (3, 3), style="raster")
|
||||
assert grid == [
|
||||
[(0, 0), (0, 100), (0, 200)],
|
||||
[(100, 0), (100, 100), (100, 200)],
|
||||
[(200, 0), (200, 100), (200, 200)],
|
||||
]
|
||||
|
||||
|
||||
def test_construct_grid_snake():
|
||||
grid = scan.construct_grid((0, 0), (100, 100), (3, 3), style="snake")
|
||||
assert grid == [
|
||||
[(0, 0), (0, 100), (0, 200)],
|
||||
[(100, 200), (100, 100), (100, 0)],
|
||||
[(200, 0), (200, 100), (200, 200)],
|
||||
]
|
||||
|
||||
|
||||
def test_construct_grid_spiral():
|
||||
grid = scan.construct_grid((0, 0), (100, 100), (3, 0), style="spiral")
|
||||
assert grid == [
|
||||
[(0, 0)],
|
||||
[
|
||||
(0, 100),
|
||||
(100, 100),
|
||||
(100, 0),
|
||||
(100, -100),
|
||||
(0, -100),
|
||||
(-100, -100),
|
||||
(-100, 0),
|
||||
(-100, 100),
|
||||
],
|
||||
[
|
||||
(-100, 200),
|
||||
(0, 200),
|
||||
(100, 200),
|
||||
(200, 200),
|
||||
(200, 100),
|
||||
(200, 0),
|
||||
(200, -100),
|
||||
(200, -200),
|
||||
(100, -200),
|
||||
(0, -200),
|
||||
(-100, -200),
|
||||
(-200, -200),
|
||||
(-200, -100),
|
||||
(-200, 0),
|
||||
(-200, 100),
|
||||
(-200, 200),
|
||||
],
|
||||
]
|
||||
|
||||
# Ensure second n_steps value makes no difference
|
||||
assert grid == scan.construct_grid((0, 0), (100, 100), (3, 3), style="spiral")
|
||||
Loading…
Add table
Add a link
Reference in a new issue