mirror of
https://github.com/ProvableHQ/leo.git
synced 2025-01-02 07:02:12 +03:00
add new tests for new import structure, as well as deprecating hardcoding stubs
This commit is contained in:
parent
bbf1e01145
commit
c809268084
10
tests/tests/parser/program/import.leo
Normal file
10
tests/tests/parser/program/import.leo
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
*/
|
||||
import hello.aleo;
|
||||
program test.aleo {
|
||||
function main() {
|
||||
let x:u8 = 1u8;
|
||||
}
|
||||
}
|
10
tests/tests/parser/program/import_fail.leo
Normal file
10
tests/tests/parser/program/import_fail.leo
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
*/
|
||||
import hello.leo;
|
||||
program test.aleo {
|
||||
function main() {
|
||||
let x:u8 = 1u8;
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
stub credits.aleo {
|
||||
import battleship.aleo;
|
||||
import exchange.aleo;
|
||||
record credits {
|
||||
owner: address,
|
||||
micrcredits: u64,
|
||||
}
|
||||
struct Row {
|
||||
c1: u8,
|
||||
c2: u8,
|
||||
c3: u8
|
||||
}
|
||||
mapping num_winners: u8 => u8;
|
||||
|
||||
record board_state {
|
||||
owner: address,
|
||||
// The hits and misses registered on the opponent's board.
|
||||
hits_and_misses: u64,
|
||||
// The squares that have been played on the opponent's board.
|
||||
played_tiles: u64,
|
||||
// The ship bitstring representing all ship positions on your own board
|
||||
ships: u64,
|
||||
player_1: address,
|
||||
player_2: address,
|
||||
game_started: bool,
|
||||
}
|
||||
|
||||
transition mint(public a1: address, public a2: u64) -> credits;
|
||||
|
||||
transition transfer_public(public a1: address, public a2: u64) -> exchange.aleo/tokens;
|
||||
|
||||
transition transfer_private(a1: credits, a2: address, a3: u64) -> (credits, credits);
|
||||
|
||||
transition transfer_private_to_public(a1: credits, public a2: address, public a3: u64) -> credits;
|
||||
|
||||
transition transfer_public_to_private(public a1: address, public a2: u64) -> credits;
|
||||
|
||||
transition join(a1: credits, a2: credits) -> credits;
|
||||
|
||||
transition split(a1: credits, a2: u64) -> (credits, credits);
|
||||
|
||||
function foo() {
|
||||
let a:u8 = 1u8;
|
||||
}
|
||||
finalize foo() {
|
||||
let c:u8 = 1u8;
|
||||
}
|
||||
}
|
||||
|
||||
program test.aleo {
|
||||
transition foo(arg1: address, arg1: u64, cred: credits.aleo/credits)->credits.aleo/credits {
|
||||
credits.aleo/transfer_public(arg1, arg2);
|
||||
credits.leo/transfer_public(arg1, arg2);
|
||||
}
|
||||
}
|
@ -4,19 +4,56 @@ expectation: Fail
|
||||
*/
|
||||
|
||||
stub credits.aleo {
|
||||
transition split(a1: credits, a2: u64) -> (credits, credits) {}
|
||||
import battleship.aleo;
|
||||
import exchange.aleo;
|
||||
record credits {
|
||||
owner: address,
|
||||
micrcredits: u64,
|
||||
}
|
||||
struct Row {
|
||||
c1: u8,
|
||||
c2: u8,
|
||||
c3: u8
|
||||
}
|
||||
mapping num_winners: u8 => u8;
|
||||
|
||||
function foo();
|
||||
}
|
||||
record board_state {
|
||||
owner: address,
|
||||
// The hits and misses registered on the opponent's board.
|
||||
hits_and_misses: u64,
|
||||
// The squares that have been played on the opponent's board.
|
||||
played_tiles: u64,
|
||||
// The ship bitstring representing all ship positions on your own board
|
||||
ships: u64,
|
||||
player_1: address,
|
||||
player_2: address,
|
||||
game_started: bool,
|
||||
}
|
||||
|
||||
stub big.leo {
|
||||
transition split(a1: credits, a2: u64) -> (credits, credits) {
|
||||
credits.aleo/split(a1, a2);
|
||||
transition mint(public a1: address, public a2: u64) -> credits;
|
||||
|
||||
transition transfer_public(public a1: address, public a2: u64) -> exchange.aleo/tokens;
|
||||
|
||||
transition transfer_private(a1: credits, a2: address, a3: u64) -> (credits, credits);
|
||||
|
||||
transition transfer_private_to_public(a1: credits, public a2: address, public a3: u64) -> credits;
|
||||
|
||||
transition transfer_public_to_private(public a1: address, public a2: u64) -> credits;
|
||||
|
||||
transition join(a1: credits, a2: credits) -> credits;
|
||||
|
||||
transition split(a1: credits, a2: u64) -> (credits, credits);
|
||||
|
||||
function foo() {
|
||||
let a:u8 = 1u8;
|
||||
}
|
||||
finalize foo() {
|
||||
let c:u8 = 1u8;
|
||||
}
|
||||
}
|
||||
|
||||
program test.aleo {
|
||||
transition foo(arg1: address, arg1: u64) {
|
||||
transition foo(arg1: address, arg1: u64, cred: credits.aleo/credits)->credits.aleo/credits {
|
||||
credits.aleo/transfer_public(arg1, arg2);
|
||||
credits.leo/transfer_public(arg1, arg2);
|
||||
}
|
||||
|
@ -20,6 +20,10 @@ let x: i8 = x();
|
||||
|
||||
let x: string = expr;
|
||||
|
||||
let x: credits = credits.aleo/mint_private(100u64);
|
||||
|
||||
let x: credits.aleo/credits = credits.aleo/mint_private(100u64);
|
||||
|
||||
|
||||
let x: u32 = expr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user