-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rsoeldner/repl-args
- Loading branch information
Showing
15 changed files
with
426 additions
and
191 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,23 @@ | ||
(module fv-regression g | ||
(defcap g () true) | ||
|
||
(defun f () | ||
@model | ||
[(property (+ 1 2)) | ||
(property | ||
(forall (a:integer) | ||
123 | ||
) | ||
) | ||
(property | ||
(exists (a:integer b:string c:time) | ||
456 | ||
) | ||
) | ||
(whatever (it parses literally:anything{}[][]&%^@) | ||
as long as it is legal lisp) | ||
] | ||
1 | ||
) | ||
|
||
) |
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,16 @@ | ||
|
||
(module lazyEval g | ||
(defcap g () true) | ||
|
||
(defschema lazy-schema field1:integer) | ||
|
||
(deftable lazy-table:{lazy-schema}) | ||
|
||
(defun write-dummy-value () | ||
(write lazy-table "greg-key" {"field1":100000}) | ||
{"field1":100000} | ||
) | ||
) | ||
|
||
(create-table lazy-table) | ||
(expect "expect first and second arguments are lazy" (read lazy-table "greg-key") (write-dummy-value)) |
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,70 @@ | ||
(begin-tx) | ||
(module ezfree g | ||
(defcap g () true) | ||
(defun ALLOW () true) | ||
) | ||
|
||
(define-namespace 'free (create-user-guard (ALLOW)) (create-user-guard (ALLOW))) | ||
(commit-tx) | ||
|
||
(begin-tx) | ||
(interface iface | ||
(defun f:integer (a:integer)) | ||
) | ||
(commit-tx) | ||
(begin-tx) | ||
(module self-reference1 SR1G | ||
(implements iface) | ||
(defcap SR1G () true) | ||
|
||
(defun f:integer (a:integer) (+ a 1)) | ||
|
||
(defun self-referential1(a:module{iface}) (a::f 1)) | ||
|
||
(defun run () | ||
(self-referential1 self-reference1) | ||
) | ||
) | ||
|
||
(expect "self-reference without a namespace works" 2 (run)) | ||
|
||
(commit-tx) | ||
|
||
(begin-tx) | ||
(namespace 'free) | ||
|
||
(module self-reference2 SR2G | ||
(implements iface) | ||
(defcap SR2G () true) | ||
|
||
(defun f:integer (a:integer) (+ a 1)) | ||
|
||
(defun self-referential2(a:module{iface}) (a::f 1)) | ||
|
||
(defun run () | ||
(self-referential2 self-reference2) | ||
) | ||
) | ||
|
||
|
||
(expect "self-reference with a namespace works" 2 (run)) | ||
(commit-tx) | ||
(begin-tx) | ||
(namespace 'free) | ||
|
||
(module self-reference2 SR2G | ||
(implements iface) | ||
(defcap SR2G () true) | ||
|
||
(defun f:integer (a:integer) (+ a 1)) | ||
|
||
(defun self-referential2(a:module{iface}) (a::f 2)) | ||
|
||
(defun run () | ||
(self-referential2 free.self-reference2) | ||
) | ||
) | ||
|
||
(expect "self-reference with a namespace qualified works" 3 (run)) | ||
|
||
(commit-tx) |
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
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,88 @@ | ||
(module ezfree g | ||
(defcap g () true) | ||
(defun ALLOW () true) | ||
) | ||
|
||
(define-namespace 'free (create-user-guard (ALLOW)) (create-user-guard (ALLOW))) | ||
|
||
(begin-tx) | ||
(namespace 'free) | ||
(interface token-policy-v2 | ||
|
||
(defschema token-info | ||
id:string | ||
supply:decimal | ||
precision:integer | ||
uri:string | ||
policies:[module{token-policy-v2}]) | ||
|
||
(defun enforce-mint:bool | ||
( token:object{token-info} | ||
account:string | ||
guard:guard | ||
amount:decimal | ||
) | ||
@doc "Minting policy for TOKEN to ACCOUNT for AMOUNT." | ||
@model [ | ||
(property (!= account "")) | ||
(property (> amount 0.0)) | ||
] | ||
) | ||
|
||
(defun enforce-burn:bool | ||
( token:object{token-info} | ||
account:string | ||
amount:decimal | ||
) | ||
@doc "Burning policy for TOKEN to ACCOUNT for AMOUNT." | ||
@model [ | ||
(property (!= account "")) | ||
(property (> amount 0.0)) | ||
] | ||
) | ||
|
||
(defun enforce-init:bool | ||
(token:object{token-info}) | ||
@doc "Enforce policy on TOKEN initiation." | ||
) | ||
|
||
(defun enforce-offer:bool | ||
( token:object{token-info} | ||
seller:string | ||
amount:decimal | ||
timeout:integer | ||
sale-id:string ) | ||
@doc "Offer policy of sale SALE-ID by SELLER of AMOUNT of TOKEN." | ||
) | ||
|
||
(defun enforce-buy:bool | ||
( token:object{token-info} | ||
seller:string | ||
buyer:string | ||
buyer-guard:guard | ||
amount:decimal | ||
sale-id:string ) | ||
@doc "Buy policy on SALE-ID by SELLER to BUYER AMOUNT of TOKEN." | ||
) | ||
|
||
(defun enforce-withdraw:bool | ||
( token:object{token-info} | ||
seller:string | ||
amount:decimal | ||
timeout:integer | ||
sale-id:string ) | ||
@doc "Withdraw policy on SALE-ID by SELLER of AMOUNT of TOKEN" | ||
) | ||
|
||
(defun enforce-transfer:bool | ||
( token:object{token-info} | ||
sender:string | ||
guard:guard | ||
receiver:string | ||
amount:decimal ) | ||
@doc " Enforce rules on transfer of TOKEN AMOUNT from SENDER to RECEIVER. \ | ||
\ Also governs rotate of SENDER (with same RECEIVER and 0.0 AMOUNT). " | ||
) | ||
|
||
) | ||
(commit-tx) |
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
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
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
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
Oops, something went wrong.