-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
57 lines (43 loc) · 1.52 KB
/
test.py
File metadata and controls
57 lines (43 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#####File for testing functions#####
import integration as int
from hypothesis import strategies as st
from hypothesis import given
from hypothesis.extra import numpy as enp
import numpy as np
@given(coord = st.tuples(st.floats(),st.floats()))
def test_phi(coord):
"""
Tests
if returns two float
if the momenta is zero and if the coordinate q is different from zero
"""
q , p = int.phi(coord[0],coord[1])
assert isinstance(q, float)
assert isinstance(p, float)
#assert p == 0
@given(coord = st.tuples(st.floats(),st.floats(),st.floats(),st.floats(),st.floats()))
def test_euler(coord):
"""
Tests
if returns two float
if the evolution of p is different from zero
if the q is diferent from zero only if the momenta is different from zero
"""
evoq, evop = int.euler(coord[0],coord[1],abs(coord[2]),coord[3],coord[4])
assert isinstance(evoq , float)
assert isinstance(evop, float)
@given(coord = st.tuples(st.floats(),st.floats(),st.floats(),st.floats(),st.floats()))
def test_simplettic(coord):
"""
Tests
if returns two float
if the evolution of p is different from zero
if the q is diferent from zero only if the momenta is different from zero
"""
evoq, evop = int.simplettic(coord[0],coord[1],abs(coord[2]),coord[3],coord[4])
assert isinstance(evoq , float)
assert isinstance(evop, float)
@given(rho = enp.arrays(float,(1,10)))
def test_entropy(rho):
assert isinstance(rho, np.ndarray)
assert isinstance(int.entropy(rho), float)