add new tests for new import structure, as well as deprecating hardcoding stubs

This commit is contained in:
evan-schott 2023-11-30 10:38:54 -08:00
parent bbf1e01145
commit c809268084
5 changed files with 68 additions and 67 deletions

View File

@ -0,0 +1,10 @@
/*
namespace: Parse
expectation: Pass
*/
import hello.aleo;
program test.aleo {
function main() {
let x:u8 = 1u8;
}
}

View File

@ -0,0 +1,10 @@
/*
namespace: Parse
expectation: Fail
*/
import hello.leo;
program test.aleo {
function main() {
let x:u8 = 1u8;
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;