Skip to content

Commit 1e470d7

Browse files
m_igashim_igashi
authored andcommitted
fix: use POSIX-compatible arithmetic in compatibility test script
Replace ((VAR++)) with VAR=$((VAR + 1)) to avoid issues with bash's set -e when the variable is 0 (which causes the expression to return 1 and trigger an exit).
1 parent 61c4e3a commit 1e470d7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/compatibility-test.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ run_test() {
135135
# Use -s s to skip tag writing for pure audio comparison
136136
if ! "$MP3GAIN_BIN" -s s "${args[@]}" "$test_original" > /dev/null 2>&1; then
137137
log " ${YELLOW}SKIP${NC}: mp3gain failed on this test"
138-
((SKIP_COUNT++))
138+
SKIP_COUNT=$((SKIP_COUNT + 1))
139139
return 0
140140
fi
141141

142142
# Apply with mp3rgain
143143
# Use -s s to skip tag writing for pure audio comparison
144144
if ! "$MP3RGAIN_BIN" -s s "${args[@]}" "$test_new" > /dev/null 2>&1; then
145145
log " ${RED}FAIL${NC}: mp3rgain failed on this test"
146-
((FAIL_COUNT++))
146+
FAIL_COUNT=$((FAIL_COUNT + 1))
147147
return 1
148148
fi
149149

@@ -156,13 +156,13 @@ run_test() {
156156
if [ "$hash_original" = "$hash_new" ]; then
157157
log " ${GREEN}PASS${NC}: $test_name"
158158
log_verbose " Hash: $hash_original"
159-
((PASS_COUNT++))
159+
PASS_COUNT=$((PASS_COUNT + 1))
160160
return 0
161161
else
162162
log " ${RED}FAIL${NC}: $test_name - hashes differ"
163163
log " mp3gain: $hash_original"
164164
log " mp3rgain: $hash_new"
165-
((FAIL_COUNT++))
165+
FAIL_COUNT=$((FAIL_COUNT + 1))
166166
return 1
167167
fi
168168
}
@@ -235,12 +235,12 @@ test_undo() {
235235
# Compare mp3gain and mp3rgain results
236236
if [ "$hash_original" = "$hash_new" ]; then
237237
log " ${GREEN}PASS${NC}: undo produces identical results"
238-
((PASS_COUNT++))
238+
PASS_COUNT=$((PASS_COUNT + 1))
239239
else
240240
log " ${RED}FAIL${NC}: undo results differ"
241241
log " mp3gain: $hash_original"
242242
log " mp3rgain: $hash_new"
243-
((FAIL_COUNT++))
243+
FAIL_COUNT=$((FAIL_COUNT + 1))
244244
fi
245245
}
246246

0 commit comments

Comments
 (0)