forked from stacs-cp/AutoIG
-
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
Showing
18 changed files
with
124 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
|
||
# Tests for Discriminating Instance Generation | ||
|
||
# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines | ||
|
||
# This script runs less intensive tests, intended for push requests rather than a PR | ||
|
||
# Lines being checked for | ||
lines=( | ||
"too difficult instances for the favoured solver" | ||
) | ||
|
||
testsPassed=0 | ||
testsRun=0 | ||
|
||
start=$(date +%s) | ||
|
||
# Loop through each script in the tests directory | ||
for file in pr_discrim_tests/*; do | ||
((testsRun++)) | ||
# Check if file | ||
if [[ -f "$file" ]]; then | ||
|
||
# Run contents of file | ||
output=$(bash "$file") | ||
all_lines_found=true | ||
|
||
# Check for each line in the array | ||
for line in "${lines[@]}"; do | ||
if [[ "$output" != *"$line"* ]]; then | ||
all_lines_found=false | ||
echo "Test $testsRun: $file failed, line not found: $line" | ||
fi | ||
done | ||
|
||
# If all lines are found, count as passed | ||
if $all_lines_found; then | ||
echo "Test $testsRun: $file passed, all lines found in output" | ||
((testsPassed++)) | ||
fi | ||
fi | ||
# Record end time and calculate elapsed time | ||
end=$(date +%s) | ||
elapsedTime=$((end - start)) | ||
|
||
# Display time elapsed | ||
echo "Time elapsed: $elapsedTime seconds" | ||
done | ||
|
||
# Final results | ||
if [[ "$testsRun" -eq "$testsPassed" ]]; then | ||
printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" | ||
exit 0 | ||
else | ||
printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" | ||
exit 1 | ||
fi |
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
# Tests for discriminating instance generation | ||
|
||
# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines | ||
|
||
# This script runs less intensive tests, intended for push requests rather than a PR | ||
|
||
# Lines being checked for | ||
lines=( | ||
"instances where the base solver wins" | ||
"too easy instances for the base solver" | ||
"Info of discriminating instances is saved to" | ||
) | ||
|
||
testsPassed=0 | ||
testsRun=0 | ||
|
||
start=$(date +%s) | ||
|
||
# Loop through each script in the tests directory | ||
for file in push_discrim_tests/*; do | ||
((testsRun++)) | ||
# Check if file | ||
if [[ -f "$file" ]]; then | ||
|
||
# Run contents of file | ||
output=$(bash "$file") | ||
all_lines_found=true | ||
|
||
# Check for each line in the array | ||
for line in "${lines[@]}"; do | ||
if [[ "$output" != *"$line"* ]]; then | ||
all_lines_found=false | ||
echo "Test $testsRun: $file failed, line not found: $line" | ||
fi | ||
done | ||
|
||
# If all lines are found, count as passed | ||
if $all_lines_found; then | ||
echo "Test $testsRun: $file passed, all lines found in output" | ||
((testsPassed++)) | ||
fi | ||
fi | ||
# Record end time and calculate elapsed time | ||
end=$(date +%s) | ||
elapsedTime=$((end - start)) | ||
|
||
# Display time elapsed | ||
echo "Time elapsed: $elapsedTime seconds" | ||
done | ||
|
||
# Final results | ||
if [[ "$testsRun" -eq "$testsPassed" ]]; then | ||
printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" | ||
exit 0 | ||
else | ||
printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" | ||
exit 1 | ||
fi |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.