Merge branch 'dev' into refactor/everything
This commit is contained in:
commit
fed4891840
@ -1,3 +1,5 @@
|
|||||||
|
// Test PascaLIGO arithmetic operators
|
||||||
|
|
||||||
function mod_op (const n : int) : nat is
|
function mod_op (const n : int) : nat is
|
||||||
begin skip end with n mod 42
|
begin skip end with n mod 42
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test PascaLIGO bitwise operators
|
||||||
|
|
||||||
function or_op (const n : nat) : nat is
|
function or_op (const n : nat) : nat is
|
||||||
begin skip end with bitwise_or(n , 4n)
|
begin skip end with bitwise_or(n , 4n)
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test PascaLIGO boolean operators
|
||||||
|
|
||||||
function or_true (const b : bool) : bool is
|
function or_true (const b : bool) : bool is
|
||||||
begin skip end with b or True
|
begin skip end with b or True
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
// This might seem like it's covered by induction with closure-2.ligo
|
||||||
|
// But it exists to prevent a regression on the bug patched by:
|
||||||
|
// https://gitlab.com/ligolang/ligo/commit/faf3bbc06106de98189f1c1673bd57e78351dc7e
|
||||||
|
|
||||||
function foobar(const i : int) : int is
|
function foobar(const i : int) : int is
|
||||||
const j : int = 3 ;
|
const j : int = 3 ;
|
||||||
const k : int = 4 ;
|
const k : int = 4 ;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test if conditional with trivial conditions in PascaLIGO
|
||||||
|
|
||||||
function main (const i : int) : int is
|
function main (const i : int) : int is
|
||||||
begin
|
begin
|
||||||
if 1 = 1 then
|
if 1 = 1 then
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test if conditional in PascaLIGO
|
||||||
|
|
||||||
function main (const i : int) : int is
|
function main (const i : int) : int is
|
||||||
var result : int := 23 ;
|
var result : int := 23 ;
|
||||||
begin
|
begin
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test PasaLIGO variable declarations inside of a block
|
||||||
|
|
||||||
function main (const i : int) : int is block {
|
function main (const i : int) : int is block {
|
||||||
const j : int = 42 ;
|
const j : int = 42 ;
|
||||||
} with j
|
} with j
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test PascaLIGO top level declarations
|
||||||
|
|
||||||
const foo : int = 42
|
const foo : int = 42
|
||||||
|
|
||||||
function main (const i : int) : int is
|
function main (const i : int) : int is
|
||||||
|
@ -1 +1,3 @@
|
|||||||
const foo : nat = 42 + "bar"
|
// Test that PascaLIGO will reject a type declaration with improper value expression
|
||||||
|
|
||||||
|
const foo : nat = 42 + "bar"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test a PascaLIGO function with more complex logic than function.ligo
|
||||||
|
|
||||||
function main (const i : int) : int is
|
function main (const i : int) : int is
|
||||||
var j : int := 0 ;
|
var j : int := 0 ;
|
||||||
var k : int := 1 ;
|
var k : int := 1 ;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test a PascaLIGO function which uses other functions as subroutines
|
||||||
|
|
||||||
function inc ( const i : int ) : int is
|
function inc ( const i : int ) : int is
|
||||||
block { skip } with i + 1
|
block { skip } with i + 1
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test a trivial PascaLIGO function
|
||||||
|
|
||||||
function main (const i : int) : int is
|
function main (const i : int) : int is
|
||||||
begin
|
begin
|
||||||
skip
|
skip
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// Implementation of the heap data structure in PascaLIGO
|
||||||
|
// See: https://en.wikipedia.org/wiki/Heap_%28data_structure%29
|
||||||
|
|
||||||
type heap is map(nat, heap_element) ;
|
type heap is map(nat, heap_element) ;
|
||||||
|
|
||||||
function is_empty (const h : heap) : bool is
|
function is_empty (const h : heap) : bool is
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test a PascaLIGO function which takes another PascaLIGO function as an argument
|
||||||
|
|
||||||
function foobar (const i : int) : int is
|
function foobar (const i : int) : int is
|
||||||
function foo (const i : int) : int is
|
function foo (const i : int) : int is
|
||||||
block { skip } with i ;
|
block { skip } with i ;
|
||||||
|
@ -1 +1,3 @@
|
|||||||
|
// Test PascaLIGO inclusion statements, see includer.ligo
|
||||||
|
|
||||||
const foo : int = 144
|
const foo : int = 144
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test PascaLIGO inclusion statements, see included.ligo
|
||||||
|
|
||||||
#include "included.ligo"
|
#include "included.ligo"
|
||||||
|
|
||||||
const bar : int = foo
|
const bar : int = foo
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test list type and related built-in functions in PascaLIGO
|
||||||
|
|
||||||
type foobar is list(int)
|
type foobar is list(int)
|
||||||
|
|
||||||
const fb : foobar = list
|
const fb : foobar = list
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test while loops in PascaLIGO
|
||||||
|
|
||||||
function counter (var n : nat) : nat is block {
|
function counter (var n : nat) : nat is block {
|
||||||
var i : nat := 0n ;
|
var i : nat := 0n ;
|
||||||
while (i < n) block {
|
while (i < n) block {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test map type and related built-in functions in PascaLIGO
|
||||||
|
|
||||||
type foobar is map(int, int)
|
type foobar is map(int, int)
|
||||||
|
|
||||||
const fb : foobar = map
|
const fb : foobar = map
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test the pattern matching functionality of PascaLIGO
|
||||||
|
|
||||||
function match_bool (const i : int) : int is
|
function match_bool (const i : int) : int is
|
||||||
var result : int := 23 ;
|
var result : int := 23 ;
|
||||||
begin
|
begin
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test functions with several parameters in PascaLIGO
|
||||||
|
|
||||||
function ab(const a : int; const b : int) : int is
|
function ab(const a : int; const b : int) : int is
|
||||||
begin skip end with (a + b)
|
begin skip end with (a + b)
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test the option type in PascaLIGO
|
||||||
|
|
||||||
type foobar is option(int)
|
type foobar is option(int)
|
||||||
|
|
||||||
const s : foobar = Some(42)
|
const s : foobar = Some(42)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test record type in PascaLIGO
|
||||||
|
|
||||||
type foobar is record
|
type foobar is record
|
||||||
foo : int ;
|
foo : int ;
|
||||||
bar : int ;
|
bar : int ;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test set iteration in PascaLIGO
|
||||||
|
|
||||||
function iter_op (const s : set(int)) : int is
|
function iter_op (const s : set(int)) : int is
|
||||||
var r : int := 0 ;
|
var r : int := 0 ;
|
||||||
function aggregate (const i : int) : unit is
|
function aggregate (const i : int) : unit is
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Test set type and basic operations in PascaLIGO
|
||||||
|
|
||||||
const s_e : set(string) = (set_empty : set(string))
|
const s_e : set(string) = (set_empty : set(string))
|
||||||
|
|
||||||
const s_fb : set(string) = set [
|
const s_fb : set(string) = set [
|
||||||
|
Loading…
Reference in New Issue
Block a user