-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add property test for expression conversion
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from hypothesis import given, settings, strategies as st | ||
|
||
import rflx.expression as expr | ||
from tests.property import strategies | ||
|
||
|
||
@given( | ||
st.one_of( | ||
strategies.mathematical_expressions( | ||
st.one_of( | ||
strategies.numbers() | ||
| strategies.variables(strategies.identifiers()) | ||
| strategies.attributes(strategies.identifiers()) | ||
) | ||
), | ||
strategies.boolean_relations( | ||
st.one_of(strategies.aggregates(strategies.numbers()) | strategies.strings()), | ||
), | ||
strategies.boolean_expressions( | ||
st.one_of( | ||
strategies.mathematical_expressions( | ||
st.one_of( | ||
strategies.numbers() | ||
| strategies.variables(strategies.identifiers()) | ||
| strategies.attributes(strategies.identifiers()) | ||
) | ||
) | ||
) | ||
), | ||
strategies.calls( | ||
st.one_of( | ||
strategies.numbers() | ||
| strategies.variables(strategies.identifiers()) | ||
| strategies.attributes(strategies.identifiers()) | ||
) | ||
), | ||
strategies.quantified_expressions( | ||
st.one_of( | ||
strategies.numbers() | ||
| strategies.variables(strategies.identifiers()) | ||
| strategies.attributes(strategies.identifiers()) | ||
) | ||
), | ||
strategies.strings(), | ||
strategies.aggregates(strategies.numbers()), | ||
) | ||
) | ||
@settings(deadline=None) | ||
def test_conversion(expression: expr.Expr) -> None: | ||
assert expression.ada_expr().rflx_expr() == expression |