Skip to content

Commit

Permalink
test: fix path to test_to_byte_array.sh in run-core-tests.sh (#258)
Browse files Browse the repository at this point in the history
<!-- enter the gh issue after hash -->

Fix path to `test_to_byte_array.sh` in `run-core-tests.sh` 

<!-- PR description below -->

Co-authored-by: Brandon R <[email protected]>
  • Loading branch information
ptisserand and b-j-roberts authored Oct 16, 2024
1 parent ce878fe commit f75c637
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/run-core-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BASE_DIR=$TEST_DIR/..
SCRIPT_DIR=$BASE_DIR/scripts
TEXT_TO_BYTE_ARRAY_SCRIPT="$BASE_DIR/scripts/text_to_byte_array.sh"

echo "Building shinigami..."
cd $BASE_DIR && scarb build
Expand Down Expand Up @@ -82,9 +83,9 @@ jq -c '.[]' $SCRIPT_TESTS_JSON | {
# echo " "

# Run the test
ENCODED_SCRIPT_SIG=$($SCRIPT_DIR/text_to_byte_array.sh "$scriptSig") # Encoded like [["123", "456", ...], "789", 3]
ENCODED_SCRIPT_PUB_KEY=$($SCRIPT_DIR/text_to_byte_array.sh "$scriptPubKey") # Encoded like [["123", "456", ...], "789", 3]
ENCODED_FLAGS=$($SCRIPT_DIR/text_to_byte_array.sh "$flags") # Encoded like [["123", "456", ...], "789", 3]
ENCODED_SCRIPT_SIG=$($TEXT_TO_BYTE_ARRAY_SCRIPT "$scriptSig") # Encoded like [["123", "456", ...], "789", 3]
ENCODED_SCRIPT_PUB_KEY=$($TEXT_TO_BYTE_ARRAY_SCRIPT "$scriptPubKey") # Encoded like [["123", "456", ...], "789", 3]
ENCODED_FLAGS=$($TEXT_TO_BYTE_ARRAY_SCRIPT "$flags") # Encoded like [["123", "456", ...], "789", 3]
# Remove the outer brackets and join the arrays
TRIMMED_SCRIPT_SIG=$(sed 's/^\[\(.*\)\]$/\1/' <<< $ENCODED_SCRIPT_SIG)
TRIMMED_SCRIPT_PUB_KEY=$(sed 's/^\[\(.*\)\]$/\1/' <<< $ENCODED_SCRIPT_PUB_KEY)
Expand All @@ -94,7 +95,7 @@ jq -c '.[]' $SCRIPT_TESTS_JSON | {
if [ $has_witness == "true" ]; then
#TODO: Value
echo " ScriptSig: '$scriptSig' -- ScriptPubKey: '$scriptPubKey' -- Flags: '$flags' -- Expected: $expected_scripterror -- Witness: $witness"
ENCODED_WITNESS=$($SCRIPT_DIR/text_to_byte_array.sh "$witness")
ENCODED_WITNESS=$($TEXT_TO_BYTE_ARRAY_SCRIPT "$witness")
TRIMMED_WITNESS=$(sed 's/^\[\(.*\)\]$/\1/' <<< $ENCODED_WITNESS)
JOINED_INPUT="[$TRIMMED_SCRIPT_SIG,$TRIMMED_SCRIPT_PUB_KEY,$TRIMMED_FLAGS,$TRIMMED_WITNESS]"
RESULT=$(cd $BASE_DIR && scarb cairo-run --package shinigami_cmds --function main_with_witness --no-build $JOINED_INPUT)
Expand Down

0 comments on commit f75c637

Please sign in to comment.