Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Oct 30, 2023
1 parent ca88194 commit 30f7dfa
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 34 deletions.
38 changes: 19 additions & 19 deletions .circleci/test-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fi
echo "Building and running the \`bubblesort\` program..."
(
cd $EXAMPLES/bubblesort || exit
cat $EXAMPLES/bubblesort/inputs/bubblesort.in | xargs $LEO run bubble_sort || exit
$LEO run bubble_sort --file $EXAMPLES/bubblesort/inputs/bubblesort.in || exit
)
# Check that the bubblesort program ran successfully.
EXITCODE=$?
Expand All @@ -70,7 +70,7 @@ fi
echo "Building and running the \`core\` program..."
(
cd $EXAMPLES/core || exit
cat $EXAMPLES/core/inputs/core.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/core/inputs/core.in || exit
)
# Check that the core program ran successfully.
EXITCODE=$?
Expand All @@ -83,7 +83,7 @@ fi
echo "Building and running the \`groups\` program..."
(
cd $EXAMPLES/groups || exit
cat $EXAMPLES/groups/inputs/groups.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/groups/inputs/groups.in || exit
)
# Check that the groups program ran successfully.
EXITCODE=$?
Expand All @@ -96,7 +96,7 @@ fi
echo "Building and running the \`hackers-delight/ntzdebruijn\` program..."
(
cd $EXAMPLES/hackers-delight/ntzdebruijn || exit
cat $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in || exit
)
# Check that the hackers-delight/ntzdebruijn program ran successfully.
EXITCODE=$?
Expand All @@ -109,7 +109,7 @@ fi
echo "Building and running the \`hackers-delight/ntzgaudet\` program..."
(
cd $EXAMPLES/hackers-delight/ntzgaudet || exit
cat $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in || exit
)
# Check that the hackers-delight/ntzgaudet program ran successfully.
EXITCODE=$?
Expand All @@ -122,7 +122,7 @@ fi
echo "Building and running the \`hackers-delight/ntzloops\` program..."
(
cd $EXAMPLES/hackers-delight/ntzloops || exit
cat $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in || exit
)
# Check that the hackers-delight/ntzloops program ran successfully.
EXITCODE=$?
Expand All @@ -135,7 +135,7 @@ fi
echo "Building and running the \`hackers-delight/ntzmasks\` program..."
(
cd $EXAMPLES/hackers-delight/ntzmasks || exit
cat $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in || exit
)
# Check that the hackers-delight/ntzmasks program ran successfully.
EXITCODE=$?
Expand All @@ -148,7 +148,7 @@ fi
echo "Building and running the \`hackers-delight/ntzreisers\` program..."
(
cd $EXAMPLES/hackers-delight/ntzreisers || exit
cat $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in || exit
)
# Check that the hackers-delight/ntzreisers program ran successfully.
EXITCODE=$?
Expand All @@ -161,7 +161,7 @@ fi
echo "Building and running the \`hackers-delight/ntzseals\` program..."
(
cd $EXAMPLES/hackers-delight/ntzseals || exit
cat $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in || exit
)
# Check that the hackers-delight/ntzseals program ran successfully.
EXITCODE=$?
Expand All @@ -174,7 +174,7 @@ fi
echo "Building and running the \`hackers-delight/ntzsearchtree\` program..."
(
cd $EXAMPLES/hackers-delight/ntzsearchtree || exit
cat $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in || exit
)
# Check that the hackers-delight/ntzsearchtree program ran successfully.
EXITCODE=$?
Expand All @@ -187,7 +187,7 @@ fi
echo "Building and running the \`hackers-delight/ntzsmallvals\` program..."
(
cd $EXAMPLES/hackers-delight/ntzsmallvals || exit
cat $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in || exit
)
# Check that the hackers-delight/ntzsmallvals program ran successfully.
EXITCODE=$?
Expand All @@ -200,7 +200,7 @@ fi
echo "Building and running the \`helloworld\` program..."
(
cd $EXAMPLES/helloworld || exit
cat $EXAMPLES/helloworld/inputs/helloworld.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/helloworld/inputs/helloworld.in || exit
)
# Check that the helloworld program ran successfully.
EXITCODE=$?
Expand All @@ -216,10 +216,10 @@ echo "Building and running the \`interest\` programs..."
cd $EXAMPLES/interest || exit

# Run the fixed period interest program.
cat $EXAMPLES/interest/inputs/fixed.in | xargs $LEO run fixed_iteration_interest || exit
$LEO run fixed_iteration_interest --file $EXAMPLES/interest/inputs/fixed.in || exit

# Run the bounded period interest program.
cat $EXAMPLES/interest/inputs/bounded.in | xargs $LEO run bounded_iteration_interest || exit
$LEO run bounded_iteration_interest --file $EXAMPLES/interest/inputs/bounded.in || exit
)
# Check that the interest programs ran successfully.
EXITCODE=$?
Expand All @@ -232,7 +232,7 @@ fi
echo "Building and running the \`message\` program..."
(
cd $EXAMPLES/message || exit
cat $EXAMPLES/message/inputs/message.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/message/inputs/message.in || exit
)
# Check that the message program ran successfully.
EXITCODE=$?
Expand All @@ -246,7 +246,7 @@ echo "Building and running the \`tictactoe\` program..."
(
cd $EXAMPLES/tictactoe || exit
$LEO run new || exit
cat $EXAMPLES/tictactoe/inputs/tictactoe.in | xargs $LEO run make_move || exit
$LEO run make_move --file $EXAMPLES/tictactoe/inputs/tictactoe.in || exit

chmod +x $EXAMPLES/tictactoe/run.sh || exit
export -f leo
Expand All @@ -265,10 +265,10 @@ echo "Building and running the \`simple_token\` programs..."
cd $EXAMPLES/simple_token || exit

# Run the mint program.
cat $EXAMPLES/simple_token/inputs/mint.in | xargs $LEO run mint || exit
$LEO run mint --file $EXAMPLES/simple_token/inputs/mint.in || exit

# Run the transfer program.
cat $EXAMPLES/simple_token/inputs/transfer.in | xargs $LEO run transfer || exit
$LEO run transfer --file $EXAMPLES/simple_token/inputs/transfer.in || exit
)
# Check that the simple token programs ran successfully.
EXITCODE=$?
Expand Down Expand Up @@ -297,7 +297,7 @@ fi
echo "Building and running the \`twoadicity\` program..."
(
cd $EXAMPLES/twoadicity || exit
cat $EXAMPLES/twoadicity/inputs/twoadicity.in | xargs $LEO run main || exit
$LEO run main --file $EXAMPLES/twoadicity/inputs/twoadicity.in || exit
)
# Check that the two-adicity program ran successfully.
EXITCODE=$?
Expand Down
5 changes: 4 additions & 1 deletion examples/message/inputs/message.in
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
"{ first: 2field, second: 3field }"
{
first: 2field,
second: 3field
}
8 changes: 7 additions & 1 deletion examples/simple_token/inputs/transfer.in
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, amount: 100u64.private, _nonce: 0group.public }" aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 50u64
{
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private,
amount: 100u64.private,
_nonce: 0group.public
}
aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau
50u64
2 changes: 1 addition & 1 deletion examples/tictactoe/build/main.aleo
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function make_move:
ternary r17 r3.r3.c3 r93 into r102;
cast r94 r95 r96 into r103 as Row;
cast r97 r98 r99 into r104 as Row;
cast r100 r98 r99 into r105 as Row;
cast r100 r101 r102 into r105 as Row;
cast r103 r104 r105 into r106 as Board;
call check_for_win r106 1u8 into r107;
call check_for_win r106 2u8 into r108;
Expand Down
9 changes: 8 additions & 1 deletion examples/tictactoe/inputs/tictactoe.in
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
1u8 1u8 1u8 "{ r1: { c1: 0u8, c2: 0u8, c3: 0u8 }, r2: { c1: 0u8, c2: 0u8, c3: 0u8 }, r3: { c1: 0u8, c2: 0u8, c3: 0u8 } }"
1u8
1u8
1u8
{
r1: { c1: 0u8, c2: 0u8, c3: 0u8 },
r2: { c1: 0u8, c2: 0u8, c3: 0u8 },
r3: { c1: 0u8, c2: 0u8, c3: 0u8 }
}
12 changes: 4 additions & 8 deletions examples/vote/build/main.aleo
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ function propose:
assert.eq self.caller r0.proposer;
hash.bhp256 r0.title into r1 as field;
cast self.caller r1 r0 into r2 as Proposal.record;
async propose r1 into r3;
output r2 as Proposal.record;
async propose r1 into r3; output r2 as Proposal.record;
output r3 as vote.aleo/propose.future;

finalize propose:
Expand All @@ -52,8 +51,7 @@ function new_ticket:
input r0 as field.public;
input r1 as address.public;
cast r1 r0 into r2 as Ticket.record;
async new_ticket r0 into r3;
output r2 as Ticket.record;
async new_ticket r0 into r3; output r2 as Ticket.record;
output r3 as vote.aleo/new_ticket.future;

finalize new_ticket:
Expand All @@ -65,8 +63,7 @@ finalize new_ticket:

function agree:
input r0 as Ticket.record;
async agree r0.pid into r1;
output r1 as vote.aleo/agree.future;
async agree r0.pid into r1; output r1 as vote.aleo/agree.future;

finalize agree:
input r0 as field.public;
Expand All @@ -77,8 +74,7 @@ finalize agree:

function disagree:
input r0 as Ticket.record;
async disagree r0.pid into r1;
output r1 as vote.aleo/disagree.future;
async disagree r0.pid into r1; output r1 as vote.aleo/disagree.future;

finalize disagree:
input r0 as field.public;
Expand Down
6 changes: 5 additions & 1 deletion examples/vote/inputs/agree.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }"
{
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private,
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private,
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public
}
6 changes: 5 additions & 1 deletion examples/vote/inputs/disagree.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }"
{
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private,
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private,
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public
}
6 changes: 5 additions & 1 deletion examples/vote/inputs/propose.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"{ title: 2077160157502449938194577302446444field, content: 1452374294790018907888397545906607852827800436field, proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 }"
{
title: 2077160157502449938194577302446444field,
content: 1452374294790018907888397545906607852827800436field,
proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2
}

0 comments on commit 30f7dfa

Please sign in to comment.