using parametrized tests for better coverage

This commit is contained in:
Martin Diehl 2019-11-23 14:02:59 +01:00
parent 2810531c97
commit 510e4752fd
9 changed files with 311 additions and 15 deletions

View File

@ -0,0 +1,25 @@
4 header
grid a 8 b 5 c 4
size x 8e-06 y 5e-06 z 4e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 2 22 2 2 1 21
1 1 6 26 2 2 5 25
1 1 10 30 2 2 9 29
1 1 14 34 2 2 13 33
1 1 18 38 2 2 17 37
1 1 3 23 2 2 2 22
1 1 7 27 2 2 6 26
1 1 11 31 2 2 10 30
1 1 15 35 2 2 14 34
1 1 19 39 2 2 18 38
1 1 4 24 2 2 3 23
1 1 8 28 2 2 7 27
1 1 12 32 2 2 11 31
1 1 16 36 2 2 15 35
1 1 20 40 2 2 19 39
1 1 5 25 2 2 4 24
1 1 9 29 2 2 8 28
1 1 13 33 2 2 12 32
1 1 17 37 2 2 16 36
1 1 21 41 2 2 20 40

View File

@ -0,0 +1,25 @@
4 header
grid a 8 b 5 c 4
size x 8e-06 y 5e-06 z 4e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 1 2 2 2 1 1
1 1 1 2 2 2 2 1
1 1 1 6 2 2 2 5
1 1 1 10 2 2 2 9
1 1 1 14 2 2 2 13
1 1 1 2 2 2 2 1
1 1 1 2 2 2 2 1
1 1 1 6 2 2 2 5
1 1 1 10 2 2 2 9
1 1 1 14 2 2 2 13
1 1 1 3 2 2 2 2
1 1 1 3 2 2 2 2
1 1 1 7 2 2 2 6
1 1 1 11 2 2 2 10
1 1 1 15 2 2 2 14
1 1 1 4 2 2 2 3
1 1 1 4 2 2 2 3
1 1 1 8 2 2 2 7
1 1 1 12 2 2 2 11
1 1 1 16 2 2 2 15

View File

@ -0,0 +1,25 @@
4 header
grid a 8 b 5 c 4
size x 8e-06 y 5e-06 z 4e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 1 2 2 2 2 21
1 1 1 2 2 2 2 21
1 1 1 2 2 2 2 25
1 1 1 2 2 2 2 29
1 1 1 2 2 2 2 37
1 1 1 2 2 2 2 21
1 1 1 2 2 2 2 21
1 1 1 2 2 2 2 25
1 1 1 2 2 2 2 29
1 1 1 2 2 2 2 37
1 1 1 2 2 2 2 22
1 1 1 2 2 2 2 22
1 1 1 2 2 2 2 26
1 1 1 2 2 2 2 30
1 1 1 2 2 2 2 38
1 1 1 2 2 2 2 24
1 1 1 2 2 2 2 24
1 1 1 2 2 2 2 28
1 1 1 2 2 2 2 32
1 1 1 2 2 2 2 40

View File

@ -0,0 +1,25 @@
4 header
grid a 8 b 5 c 4
size x 8e-06 y 5e-06 z 4e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 1 2 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 2 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2

View File

@ -0,0 +1,85 @@
4 header
grid a 16 b 10 c 8
size x 1.6e-05 y 1e-05 z 8e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1
1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1
1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1
1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1
1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1
1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1
1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1
1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1
1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1
1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1
1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1
1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1
1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1
1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1
1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1
1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1
1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1
1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1
1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1
1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1
1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1
1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1
1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1
1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1
1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1
1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1
1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1
1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1
1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1
1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1
1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1
1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1
1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1
1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1
1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1
1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1
1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1
1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1
1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1
1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1
1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1
1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1
1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1
1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1
1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1
1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1
1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1
1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1
1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1
1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1
1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1
1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1
1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1
1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1
1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1
1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1
1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1
1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1
1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1
1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1
1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1
1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1
1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1
1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1
1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1
1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1
1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1
1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1
1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1
1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1
1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1
1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1
1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1
1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1
1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1
1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1
1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1
1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1
1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1
1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1

View File

@ -1,6 +1,6 @@
4 header
grid a 14 b 5 c 6
size x 1.4e-05 y 5e-06 z 6e-06
grid a 14 b 5 c 4
size x 1.4e-05 y 5e-06 z 4e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 2 22 2 2 1 21 1 2 2 22 2 1
@ -23,13 +23,3 @@ homogenization 1
1 1 13 33 2 2 12 32 12 2 2 33 13 1
1 1 17 37 2 2 16 36 16 2 2 37 17 1
1 1 21 41 2 2 20 40 20 2 2 41 21 1
1 1 4 24 2 2 3 23 3 2 2 24 4 1
1 1 8 28 2 2 7 27 7 2 2 28 8 1
1 1 12 32 2 2 11 31 11 2 2 32 12 1
1 1 16 36 2 2 15 35 15 2 2 36 16 1
1 1 20 40 2 2 19 39 19 2 2 40 20 1
1 1 3 23 2 2 2 22 2 2 2 23 3 1
1 1 7 27 2 2 6 26 6 2 2 27 7 1
1 1 11 31 2 2 10 30 10 2 2 31 11 1
1 1 15 35 2 2 14 34 14 2 2 35 15 1
1 1 19 39 2 2 18 38 18 2 2 39 19 1

View File

@ -0,0 +1,53 @@
4 header
grid a 8 b 8 c 6
size x 8e-06 y 8.000000000000001e-06 z 6e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 2 22 2 2 1 21
1 1 6 26 2 2 5 25
1 1 10 30 2 2 9 29
1 1 14 34 2 2 13 33
1 1 18 38 2 2 17 37
1 1 14 34 2 2 13 33
1 1 10 30 2 2 9 29
1 1 6 26 2 2 5 25
1 1 3 23 2 2 2 22
1 1 7 27 2 2 6 26
1 1 11 31 2 2 10 30
1 1 15 35 2 2 14 34
1 1 19 39 2 2 18 38
1 1 15 35 2 2 14 34
1 1 11 31 2 2 10 30
1 1 7 27 2 2 6 26
1 1 4 24 2 2 3 23
1 1 8 28 2 2 7 27
1 1 12 32 2 2 11 31
1 1 16 36 2 2 15 35
1 1 20 40 2 2 19 39
1 1 16 36 2 2 15 35
1 1 12 32 2 2 11 31
1 1 8 28 2 2 7 27
1 1 5 25 2 2 4 24
1 1 9 29 2 2 8 28
1 1 13 33 2 2 12 32
1 1 17 37 2 2 16 36
1 1 21 41 2 2 20 40
1 1 17 37 2 2 16 36
1 1 13 33 2 2 12 32
1 1 9 29 2 2 8 28
1 1 4 24 2 2 3 23
1 1 8 28 2 2 7 27
1 1 12 32 2 2 11 31
1 1 16 36 2 2 15 35
1 1 20 40 2 2 19 39
1 1 16 36 2 2 15 35
1 1 12 32 2 2 11 31
1 1 8 28 2 2 7 27
1 1 3 23 2 2 2 22
1 1 7 27 2 2 6 26
1 1 11 31 2 2 10 30
1 1 15 35 2 2 14 34
1 1 19 39 2 2 18 38
1 1 15 35 2 2 14 34
1 1 11 31 2 2 10 30
1 1 7 27 2 2 6 26

View File

@ -0,0 +1,53 @@
4 header
grid a 14 b 8 c 6
size x 1.4e-05 y 8.000000000000001e-06 z 6e-06
origin x 0.0 y 0.0 z 0.0
homogenization 1
1 1 2 22 2 2 1 21 1 2 2 22 2 1
1 1 6 26 2 2 5 25 5 2 2 26 6 1
1 1 10 30 2 2 9 29 9 2 2 30 10 1
1 1 14 34 2 2 13 33 13 2 2 34 14 1
1 1 18 38 2 2 17 37 17 2 2 38 18 1
1 1 14 34 2 2 13 33 13 2 2 34 14 1
1 1 10 30 2 2 9 29 9 2 2 30 10 1
1 1 6 26 2 2 5 25 5 2 2 26 6 1
1 1 3 23 2 2 2 22 2 2 2 23 3 1
1 1 7 27 2 2 6 26 6 2 2 27 7 1
1 1 11 31 2 2 10 30 10 2 2 31 11 1
1 1 15 35 2 2 14 34 14 2 2 35 15 1
1 1 19 39 2 2 18 38 18 2 2 39 19 1
1 1 15 35 2 2 14 34 14 2 2 35 15 1
1 1 11 31 2 2 10 30 10 2 2 31 11 1
1 1 7 27 2 2 6 26 6 2 2 27 7 1
1 1 4 24 2 2 3 23 3 2 2 24 4 1
1 1 8 28 2 2 7 27 7 2 2 28 8 1
1 1 12 32 2 2 11 31 11 2 2 32 12 1
1 1 16 36 2 2 15 35 15 2 2 36 16 1
1 1 20 40 2 2 19 39 19 2 2 40 20 1
1 1 16 36 2 2 15 35 15 2 2 36 16 1
1 1 12 32 2 2 11 31 11 2 2 32 12 1
1 1 8 28 2 2 7 27 7 2 2 28 8 1
1 1 5 25 2 2 4 24 4 2 2 25 5 1
1 1 9 29 2 2 8 28 8 2 2 29 9 1
1 1 13 33 2 2 12 32 12 2 2 33 13 1
1 1 17 37 2 2 16 36 16 2 2 37 17 1
1 1 21 41 2 2 20 40 20 2 2 41 21 1
1 1 17 37 2 2 16 36 16 2 2 37 17 1
1 1 13 33 2 2 12 32 12 2 2 33 13 1
1 1 9 29 2 2 8 28 8 2 2 29 9 1
1 1 4 24 2 2 3 23 3 2 2 24 4 1
1 1 8 28 2 2 7 27 7 2 2 28 8 1
1 1 12 32 2 2 11 31 11 2 2 32 12 1
1 1 16 36 2 2 15 35 15 2 2 36 16 1
1 1 20 40 2 2 19 39 19 2 2 40 20 1
1 1 16 36 2 2 15 35 15 2 2 36 16 1
1 1 12 32 2 2 11 31 11 2 2 32 12 1
1 1 8 28 2 2 7 27 7 2 2 28 8 1
1 1 3 23 2 2 2 22 2 2 2 23 3 1
1 1 7 27 2 2 6 26 6 2 2 27 7 1
1 1 11 31 2 2 10 30 10 2 2 31 11 1
1 1 15 35 2 2 14 34 14 2 2 35 15 1
1 1 19 39 2 2 18 38 18 2 2 39 19 1
1 1 15 35 2 2 14 34 14 2 2 35 15 1
1 1 11 31 2 2 10 30 10 2 2 31 11 1
1 1 7 27 2 2 6 26 6 2 2 27 7 1

View File

@ -51,9 +51,24 @@ class TestGeom:
new = Geom.from_file(f)
assert geom_equal(new,default)
def test_mirror(self,default,update,reference_dir):
@pytest.mark.parametrize('directions,reflect',[
(['x'], False),
(['x','y','z'],True),
(['z','x','y'],False),
(['y','z'], False)])
def test_mirror(self,default,update,reference_dir,directions,reflect):
modified = copy.deepcopy(default)
modified.mirror(['x','z'])
reference = os.path.join(reference_dir,'mirror.geom')
modified.mirror(directions,reflect)
tag = 'directions={}_reflect={}'.format('-'.join(directions),reflect)
reference = os.path.join(reference_dir,'mirror_{}.geom'.format(tag))
if update: modified.to_file(reference)
assert geom_equal(modified,Geom.from_file(reference))
@pytest.mark.parametrize('stencil',[(1),(2),(3),(4)])
def test_clean(self,default,update,reference_dir,stencil):
modified = copy.deepcopy(default)
modified.clean(stencil)
tag = 'stencil={}'.format(stencil)
reference = os.path.join(reference_dir,'clean_{}.geom'.format(tag))
if update: modified.to_file(reference)
assert geom_equal(modified,Geom.from_file(reference))