leo/.circleci/test-examples.sh

344 lines
9.3 KiB
Bash
Raw Normal View History

# Alias the leo command to use the local binary.
# Note: Use a full path for $LEO when running locally.
leo() {
$LEO "$@"
}
2022-08-10 01:58:13 +03:00
# Build and run the auction Leo program.
echo "Building and running the \`auction\` program..."
(
cd $EXAMPLES/auction || exit
2023-02-16 19:49:13 +03:00
$LEO run place_bid || exit
$LEO run resolve || exit
$LEO run finish || exit
2022-09-20 04:59:33 +03:00
chmod +x $EXAMPLES/auction/run.sh || exit
export -f leo || exit
$EXAMPLES/auction/run.sh || exit
)
2023-02-16 19:49:13 +03:00
# Check that the auction program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`auction\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the basic_bank Leo program.
echo "Building and running the \`basic_bank\` program..."
2022-09-20 18:38:05 +03:00
(
cd $EXAMPLES/basic_bank || exit
2023-02-16 19:49:13 +03:00
$LEO run issue || exit
$LEO run deposit || exit
$LEO run withdraw || exit
2022-09-20 18:38:05 +03:00
chmod +x $EXAMPLES/basic_bank/run.sh || exit
export -f leo || exit
$EXAMPLES/basic_bank/run.sh || exit
2022-09-20 18:38:05 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the basic_bank program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`basic_bank\` program failed to run successfully."
exit $EXITCODE
fi
2022-09-20 18:38:05 +03:00
# Build and run the battleship Leo program.
echo "Building and running the \`battleship\` program..."
which leo
(
cd $EXAMPLES/battleship || exit
chmod +x $EXAMPLES/battleship/run.sh || exit
export -f leo || exit
$EXAMPLES/battleship/run.sh || exit
)
2023-02-16 19:49:13 +03:00
# Check that the battleship program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`battleship\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the bubblesort Leo program.
echo "Building and running the \`bubblesort\` program..."
(
cd $EXAMPLES/bubblesort || exit
2023-02-16 20:13:42 +03:00
$LEO run bubble_sort || exit
2022-08-09 01:32:41 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the bubblesort program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`bubblesort\` program failed to run successfully."
exit $EXITCODE
fi
2022-08-09 01:32:41 +03:00
# Build and run the core example Leo program.
echo "Building and running the \`core\` program..."
2022-08-09 01:32:41 +03:00
(
cd $EXAMPLES/core || exit
2023-02-16 19:49:13 +03:00
$LEO run main || exit
2022-08-09 01:32:41 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the core program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`core\` program failed to run successfully."
exit $EXITCODE
fi
2022-08-09 01:32:41 +03:00
# Build and run the groups example Leo program.
echo "Building and running the \`groups\` program..."
2022-08-09 01:32:41 +03:00
(
cd $EXAMPLES/groups || exit
2023-02-16 19:49:13 +03:00
$LEO run main || exit
2022-08-09 01:32:41 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the groups program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`groups\` program failed to run successfully."
exit $EXITCODE
fi
2022-08-09 01:32:41 +03:00
# Build and run the hackers-delight/ntzdebruijn program.
echo "Building and running the \`hackers-delight/ntzdebruijn\` program..."
(
cd $EXAMPLES/hackers-delight/ntzdebruijn || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
# Check that the hackers-delight/ntzdebruijn program ran successfully.
2023-02-16 19:49:13 +03:00
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzdebruijn\` program failed to run successfully."
2023-02-16 19:49:13 +03:00
exit $EXITCODE
fi
# Build and run the hackers-delight/ntzgaudet program.
echo "Building and running the \`hackers-delight/ntzgaudet\` program..."
(
cd $EXAMPLES/hackers-delight/ntzgaudet || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
2023-02-16 19:49:13 +03:00
# Check that the hackers-delight/ntzgaudet program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzgaudet\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the hackers-delight/ntzloops program.
echo "Building and running the \`hackers-delight/ntzloops\` program..."
(
cd $EXAMPLES/hackers-delight/ntzloops || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
2023-02-16 19:49:13 +03:00
# Check that the hackers-delight/ntzloops program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzloops\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the hackers-delight/ntzmasks program.
echo "Building and running the \`hackers-delight/ntzmasks\` program..."
(
cd $EXAMPLES/hackers-delight/ntzmasks || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
2023-02-16 19:49:13 +03:00
# Check that the hackers-delight/ntzmasks program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzmasks\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the hackers-delight/ntzreisers program.
echo "Building and running the \`hackers-delight/ntzreisers\` program..."
(
cd $EXAMPLES/hackers-delight/ntzreisers || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
2023-02-16 19:49:13 +03:00
# Check that the hackers-delight/ntzreisers program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzreisers\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the hackers-delight/ntzseals program.
echo "Building and running the \`hackers-delight/ntzseals\` program..."
(
cd $EXAMPLES/hackers-delight/ntzseals || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
2023-02-16 19:49:13 +03:00
# Check that the hackers-delight/ntzseals program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzseals\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the hackers-delight/ntzsearchtree program.
echo "Building and running the \`hackers-delight/ntzsearchtree\` program..."
(
cd $EXAMPLES/hackers-delight/ntzsearchtree || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
2023-02-16 19:49:13 +03:00
# Check that the hackers-delight/ntzsearchtree program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzsearchtree\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the hackers-delight/ntzsmallvals program.
echo "Building and running the \`hackers-delight/ntzsmallvals\` program..."
(
cd $EXAMPLES/hackers-delight/ntzsmallvals || exit
2023-02-16 19:49:13 +03:00
$LEO run || exit
)
2023-02-16 19:49:13 +03:00
# Check that the hackers-delight/ntzsmallvals program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`hackers-delight/ntzsmallvals\` program failed to run successfully."
exit $EXITCODE
fi
2022-08-10 01:58:13 +03:00
# Build and run the helloworld Leo program.
echo "Building and running the \`helloworld\` program..."
2022-08-10 01:58:13 +03:00
(
cd $EXAMPLES/helloworld || exit
2023-02-16 19:49:13 +03:00
$LEO run main || exit
2022-08-10 01:58:13 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the helloworld program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`helloworld\` program failed to run successfully."
exit $EXITCODE
fi
2022-08-10 01:58:13 +03:00
2022-08-09 01:32:41 +03:00
2022-08-09 02:04:03 +03:00
# Build and run the interest example Leo programs.
echo "Building and running the \`interest\` programs..."
2022-08-09 02:04:03 +03:00
(
cd $EXAMPLES/interest || exit
2022-08-09 02:04:03 +03:00
# Run the fixed period interest program.
$LEO run fixed_iteration_interest || exit
2022-08-09 02:04:03 +03:00
# Run the bounded period interest program.
$LEO run bounded_iteration_interest || exit
2022-08-09 02:04:03 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the interest programs ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`interest\` program failed to run successfully."
2023-02-16 19:49:13 +03:00
exit $EXITCODE
fi
2022-08-09 02:04:03 +03:00
2022-08-09 01:32:41 +03:00
# Build and run the message example Leo program.
echo "Building and running the \`message\` program..."
2022-08-09 01:32:41 +03:00
(
cd $EXAMPLES/message || exit
2023-02-16 19:49:13 +03:00
$LEO run main || exit
2022-08-09 01:32:41 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the message program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`message\` program failed to run successfully."
exit $EXITCODE
fi
2022-08-09 01:32:41 +03:00
2022-08-10 02:01:31 +03:00
# Build and run the tic tac toe example Leo program.
echo "Building and running the \`tictactoe\` program..."
2022-08-10 02:01:31 +03:00
(
cd $EXAMPLES/tictactoe || exit
2023-02-16 19:49:13 +03:00
$LEO run new || exit
$LEO run make_move || exit
2022-09-20 05:32:31 +03:00
chmod +x $EXAMPLES/tictactoe/run.sh || exit
export -f leo
$EXAMPLES/tictactoe/run.sh || exit
2022-08-10 02:01:31 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the tic tac toe program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`tictactoe\` program failed to run successfully."
exit $EXITCODE
fi
2022-08-10 02:01:31 +03:00
2022-09-03 02:20:39 +03:00
# Build and run the simple token example programs.
echo "Building and running the \`simple_token\` programs..."
2022-08-09 01:32:41 +03:00
(
cd $EXAMPLES/simple_token || exit
2022-08-09 01:32:41 +03:00
# Run the mint program.
$LEO run mint
# Run the transfer program.
$LEO run transfer
2022-08-10 02:05:28 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the simple token programs ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`simple_token\` programs failed to run successfully."
exit $EXITCODE
fi
2022-08-10 02:05:28 +03:00
2022-09-03 02:20:39 +03:00
# Build and run the token example program.
echo "Building and running the \`token\` program..."
2022-09-03 02:20:39 +03:00
(
cd $EXAMPLES/token || exit
2022-09-03 02:20:39 +03:00
# Run the mint_public function.
2023-02-16 19:49:13 +03:00
$LEO run mint_public || exit
2022-09-03 02:20:39 +03:00
# Run the mint_private function.
2023-02-16 19:49:13 +03:00
$LEO run mint_private || exit
2022-09-03 02:20:39 +03:00
# Run the transfer_public function.
2023-02-16 19:49:13 +03:00
$LEO run transfer_public || exit
2022-09-03 02:20:39 +03:00
# Run the transfer_private function.
2023-02-16 19:49:13 +03:00
$LEO run transfer_private || exit
2022-09-03 02:20:39 +03:00
# Run the transfer_private_to_public function.
2023-02-16 19:49:13 +03:00
$LEO run transfer_private_to_public || exit
2022-09-03 02:20:39 +03:00
# Run the transfer_public_to_private function.
2023-02-16 19:49:13 +03:00
$LEO run transfer_public_to_private || exit
2022-09-03 02:20:39 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the token program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`token\` program failed to run successfully."
exit $EXITCODE
fi
2022-09-03 02:20:39 +03:00
2022-08-10 02:05:28 +03:00
# Build and run the two-adicity program.
echo "Building and running the \`twoadicity\` program..."
2022-08-10 02:05:28 +03:00
(
cd $EXAMPLES/twoadicity || exit
2023-02-16 19:49:13 +03:00
$LEO run main || exit
2022-09-03 02:20:39 +03:00
)
2023-02-16 19:49:13 +03:00
# Check that the two-adicity program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`twoadicity\` program failed to run successfully."
exit $EXITCODE
fi
# Build and run the vote Leo program.
echo "Building and running the \`vote\` program..."
(
cd $EXAMPLES/vote || exit
chmod +x $EXAMPLES/vote/run.sh || exit
export -f leo
$EXAMPLES/vote/run.sh || exit
)
2023-02-16 19:49:13 +03:00
# Check that the vote program ran successfully.
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "The \`vote\` program failed to run successfully."
exit $EXITCODE
fi