Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. ;;
  2. ;; A little example showing off the merits of formal
  3. ;; verification and why it pays off.
  4. ;;
  5.  
  6. ;;---------------------------------
  7. ;;
  8. ;; Create an 'admin-keyset' and add some key, for loading this contract!
  9. ;;
  10. ;; Make sure the message is signed with this added key as well.
  11. ;;
  12. ;;---------------------------------
  13.  
  14.  
  15. ;; Keysets cannot be created in code, thus we read them in
  16. ;; from the load message data.
  17. (define-keyset 'admin-keyset (read-keyset "admin-keyset"))
  18.  
  19. ;; Define the module.
  20. (module verification 'admin-keyset
  21. @doc "Little example to show off the usefulness of formal verification."
  22.  
  23. (defun absBug:integer (num:integer)
  24. @doc "Ensure positive result"
  25. ;; This property fails: Would you have caught that with unit tests?
  26. @model [(property (>= result 0))]
  27. (if (= (- (* (- num 6) (+ num 11)) (* 42 num)) (* (* 64 7) 52270780833))
  28. (- 1)
  29. (abs num)
  30. )
  31. )
  32. )
  33. test!!!!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement