-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Krasimir
committed
Dec 1, 2024
1 parent
1a510e0
commit 4d9fd85
Showing
2 changed files
with
8 additions
and
16 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Parameters | ||
COMMAND="$1" | ||
EXPECTED_OUTPUT="$2" | ||
# Capture the command and expected output | ||
program=$1 | ||
expected_output=$2 | ||
|
||
# Run the command and capture the output | ||
ACTUAL_OUTPUT=$($COMMAND) | ||
# Run the program and capture its output | ||
output=$($program) | ||
|
||
# Compare the actual output with the expected output | ||
if [ "$ACTUAL_OUTPUT" == "$EXPECTED_OUTPUT" ]; then | ||
echo "✅ Test passed!" | ||
# Compare the output with the expected string | ||
if [ "$output" == "$expected_output" ]; then | ||
exit 0 | ||
else | ||
echo "❌ Test failed!" | ||
echo "Expected output:" | ||
echo "================" | ||
echo "$EXPECTED_OUTPUT" | ||
echo "Actual output:" | ||
echo "================" | ||
echo "$ACTUAL_OUTPUT" | ||
exit 1 | ||
fi | ||
fi |