-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCheck.sh
More file actions
31 lines (23 loc) · 825 Bytes
/
testCheck.sh
File metadata and controls
31 lines (23 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Directory containing test case files
TEST_CASE_DIR="./tests"
# Directory to store outputs
OUTPUT_DIR="./outputs"
# Compiled C++ program
CPP_PROGRAM="./RepCRec"
# Create the output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
# Check if the C++ program exists
if [ ! -f "$CPP_PROGRAM" ]; then
echo "Error: Compiled C++ program not found at $CPP_PROGRAM"
exit 1
fi
# Iterate over all text files in the test case directory
for TEST_CASE in "$TEST_CASE_DIR"/*.txt; do
# Get the base name of the test case file (without path)
TEST_CASE_BASENAME=$(basename "$TEST_CASE")
# Define the output file path
OUTPUT_FILE="$OUTPUT_DIR/${TEST_CASE_BASENAME%.txt}_output.txt"
# Run the C++ program with the test case as input and redirect output
./$CPP_PROGRAM $TEST_CASE > $OUTPUT_FILE
done