Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
C
clean-test-properties
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • clean-and-itasks
  • clean-test-properties
  • Issues
  • #1

Closed
Open
Opened Jun 08, 2018 by Steffen Michels@smichelsMaintainer

add function preconditions

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.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: clean-and-itasks/clean-test-properties#1