clean-test-properties issueshttps://gitlab.science.ru.nl/clean-and-itasks/clean-test-properties/-/issues2020-10-13T10:25:26+02:00https://gitlab.science.ru.nl/clean-and-itasks/clean-test-properties/-/issues/1add function preconditions2020-10-13T10:25:26+02:00Steffen Michelsadd function preconditionsFor `Math.Geometry.normalize` I had to use a precondition to make tests succeed:
```
/**
* Normalizes an angle.
*
* @param the angle to normalize
* @result the normalized angle
* @property normalized degree range: A.angle :: Angle:...For `Math.Geometry.normalize` I had to use a precondition to make tests succeed:
```
/**
* Normalizes an angle.
*
* @param the angle to normalize
* @result the normalized angle
* @property normalized degree range: A.angle :: Angle:
* (abs deg <= toReal (maxint/365)) ==> (0.0 <=. degNorm /\ degNorm <=. 360.0)
* with
* deg = toDeg angle
* degNorm = toDeg (normalize angle)
* @property normalized radian range: A.angle :: Angle:
* (abs deg <= toReal (maxint/365)) ==> (0.0 <=. radNorm /\ radNorm <=. 2.0 * pi)
* with
* deg = toDeg angle
* radNorm = toRad (normalize angle)
* @property idempotence: A.angle :: Angle:
* (abs deg <= toReal (maxint/365)) ==> normalize angle ~~ normalize (normalize angle)
* with
* deg = toDeg angle
*/
normalize :: !Angle -> Angle
```
I'd be great to be able to state the precondition (`(abs deg <= toReal (maxint/365)) with deg = toDeg angle`) only once. Additionally, then this precondition is clearly documented. The precondition would have to be added to all properties of the function and there are probably some pitfalls when doing this.
For the old-style documentation maybe we can use `@param-precondition` after the `@param` it refers to. For the declarative style documentation I'm not sure yet.Camil StapsCamil Staps