--- flac.old/test/test_streams.sh	2013-03-11 10:29:30.294319458 -0500
+++ flac/test/test_streams.sh	2013-03-12 02:23:36.917638181 -0500
@@ -17,188 +17,358 @@
 #  restrictive of those mentioned above.  See the file COPYING.Xiph in this
 #  distribution.
 
-die ()
-{
-	echo $* 1>&2
-	exit 1
-}
-
+# Checks for debug build
 if [ x = x"$1" ] ; then 
 	BUILD=debug
 else
 	BUILD="$1"
 fi
 
+# Set up various paths to libs
 LD_LIBRARY_PATH=../objs/$BUILD/lib:$LD_LIBRARY_PATH
+
+# Must be exported
 export LD_LIBRARY_PATH
 export MALLOC_CHECK_=3
 export MALLOC_PERTURB_=$((RANDOM % 255 + 1))
+
+# Set up various paths to built binaries in-tree
 PATH=../src/flac:$PATH
 PATH=../src/test_streams:$PATH
 PATH=../objs/$BUILD/bin:$PATH
 
+# If FLAC__TEST_LEVEL is not set, default to '1'
 if [ x"$FLAC__TEST_LEVEL" = x ] ; then
 	FLAC__TEST_LEVEL=1
 fi
 
-flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
+# General die function
+die () {
+	printf "%s\n" "$@" 1>&2
+	exit 1
+}
 
-run_flac ()
-{
+# Run `flac' with configured arguments
+run_flac () {
+	# Test with `valgrind' if enabled.  If `flac' was _NOT_ compiled with debug
+	# symobls, this will error out and the valgrind.log will specify why
 	if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
-		echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $*" >>test_streams.valgrind.log
-		valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 flac $* 4>>test_streams.valgrind.log
+
+		# Check for `valgrind' before continuing
+		if [ -n "$valgrind_binary" ] ; then
+			# Print out command executed to log
+			printf "%s\n" "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $@" >>test_streams.valgrind.log
+
+			# `Valgrind' command wrapping around `flac'
+			"$valgrind_binary" \
+				--leak-check=yes \
+				--show-reachable=yes \
+				--num-callers=100 \
+				--log-fd=4 \
+					"$flac_binary" \
+						"$@" \
+						4>>test_streams.valgrind.log
+		else
+			die "ERROR: can't find \`valgrind' executable"
+		fi
+
+	# Run test _WITHOUT_ `valgrind'
 	else
-		flac $*
+		"$flac_binary" "$@"
 	fi
 }
 
-echo "Generating streams..."
-if [ ! -f wacky1.wav ] ; then
-	test_streams || die "ERROR during test_streams"
-fi
-
-#
-# single-file test routines
-#
-
-test_file ()
-{
-	name=$1
-	channels=$2
-	bps=$3
+# Test each FLAC file specified (from positional parameters)
+test_file () {
+	# Obtain FLAC information from positional parameters
+	name="$1"
+	channels="$2"
+	bps="$3"
 	encode_options="$4"
 
-	echo -n "$name (--channels=$channels --bps=$bps $encode_options): encode..."
-	cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding $name.raw"
-	echo "### ENCODE $name #######################################################" >> ./streams.log
-	echo "###    cmd=$cmd" >> ./streams.log
-	$cmd 2>>./streams.log || die "ERROR during encode of $name"
-
-	echo -n "decode..."
-	cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --output-name=$name.cmp $name.flac"
-	echo "### DECODE $name #######################################################" >> ./streams.log
-	echo "###    cmd=$cmd" >> ./streams.log
-	$cmd 2>>./streams.log || die "ERROR during decode of $name"
-
-	ls -1l $name.raw >> ./streams.log
-	ls -1l $name.flac >> ./streams.log
-	ls -1l $name.cmp >> ./streams.log
+	# Print current file information and operation to run
+	printf "%s\n%s" "$name (--channels=$channels --bps=$bps $encode_options):" "Encode... "
+
+	# Command to run stored as a variable
+	cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding ${name}.raw"
+
+	# Print out operation to run into log
+	printf "%s\n" "=== ENCODE:  '$name' =======================================================" >> ./streams.log
+	printf "%s\n" "=== COMMAND: '$cmd" >> ./streams.log
+
+	# Run above command, sending STDERR to log
+	$cmd 2>>./streams.log || die "ERROR: during encode of $name"
+
+	# Print newline as separator to each file in log file
+	printf '\n' >> ./streams.log
+
+	# Print current operation
+	printf "Decode... "
+
+	# Command to run stored as a variable
+	cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --output-name=${name}.cmp ${name}.flac"
+
+	# Print out operation to run into log
+	printf "%s\n" "=== DECODE:  '$name' =======================================================" >> ./streams.log
+	printf "%s\n" "=== COMMAND: '$cmd" >> ./streams.log
 
-	echo -n "compare..."
-	cmp $name.raw $name.cmp || die "ERROR during compare of $name"
+	# Run above command, sending STDERR to log
+	$cmd 2>>./streams.log || die "ERROR: during decode of $name"
 
-	echo OK
+	# Store each file's attributes into log
+	ls -1l "${name}.raw" >> ./streams.log
+	ls -1l "${name}.flac" >> ./streams.log
+	ls -1l "${name}.cmp" >> ./streams.log
+
+	# Print newline as separator to each file in log file
+	printf '\n' >> ./streams.log
+
+	# Print current operation
+	printf "Compare... "
+
+	# Compare both the 'raw' and 'cmp' FLAC byte by byte
+	cmp "${name}.raw" "${name}.cmp" || die "ERROR: during compare of $name"
+
+	# Everything is OK for current FLAC
+	printf "OK\n\n"
 }
 
-test_file_piped ()
-{
-	name=$1
-	channels=$2
-	bps=$3
+# Test each FLAC file, via a pipe, specified (from positional parameters)
+test_file_piped () {
+	# Obtain FLAC information from positional parameters
+	name="$1"
+	channels="$2"
+	bps="$3"
 	encode_options="$4"
 
-	if [ `env | grep -ic '^comspec='` != 0 ] ; then
+	# Test if running on Windows platform
+	if [ $(env | grep -ic '^comspec=') != 0 ] ; then
+		# Windows
 		is_win=yes
 	else
+		# Non Windows
 		is_win=no
 	fi
 
-	echo -n "$name: encode via pipes..."
-	if [ $is_win = yes ] ; then
-		cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout $name.raw"
-		echo "### ENCODE $name #######################################################" >> ./streams.log
-		echo "###    cmd=$cmd" >> ./streams.log
-		$cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name"
+	#-------------------#
+	# Encoding via pipe #
+	#-------------------#
+	# Print current file information and operation to run
+	printf "%s\n%s" "$name (--channels=$channels --bps=$bps $encode_options):" "Encode via pipe... "
+
+	# [ WINDOWS ] Encoding test
+	if [ "$is_win" = yes ] ; then
+		# Command to run stored as a variable
+		cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout ${name}.raw"
+
+		# Print out operation to run into log
+		printf "%s\n" "=== ENCODE:  '$name' =======================================================" >> ./streams.log
+		printf "%s\n" "=== COMMAND: '$cmd" >> ./streams.log
+
+		# Run above command, sending STDERR to log
+		$cmd 1>"${name}.flac" 2>>./streams.log || die "ERROR: during encode of $name"
+
+	# [ NON WINDOWS ] Encoding test
 	else
+		# Command to run stored as a variable
 		cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout -"
-		echo "### ENCODE $name #######################################################" >> ./streams.log
-		echo "###    cmd=$cmd" >> ./streams.log
-		cat $name.raw | $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name"
+
+		# Print out operation to run into log
+		printf "%s\n" "=== ENCODE:  '$name' =======================================================" >> ./streams.log
+		printf "%s\n" "    COMMAND: '$cmd" >> ./streams.log
+
+		# Run above command, sending STDERR to log
+		cat "${name}.raw" | $cmd 1>"${name}.flac" 2>>./streams.log || die "ERROR: during encode of $name"
 	fi
-	echo -n "decode via pipes..."
-	if [ $is_win = yes ] ; then
-		cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout $name.flac"
-		echo "### DECODE $name #######################################################" >> ./streams.log
-		echo "###    cmd=$cmd" >> ./streams.log
-		$cmd 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name"
+
+	# Print newline as separator to each file in log file
+	printf '\n' >> ./streams.log
+
+	#-------------------#
+	# Decoding via pipe #
+	#-------------------#
+	# Print current operation
+	printf "Decode... "
+
+	# [ WINDOWS ] Decoding test
+	if [ "$is_win" = yes ] ; then
+		# Command to run stored as a variable
+		cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout ${name}.flac"
+
+		# Print out operation to run into log
+		printf "%s\n" "=== DECODE:  '$name' =======================================================" >> ./streams.log
+		printf "%s\n" "=== COMMAND: '$cmd" >> ./streams.log
+
+		# Run above command, sending STDERR to log
+		$cmd 1>"${name}.cmp" 2>>./streams.log || die "ERROR: during decode of $name"
+
+	# [ NON WINDOWS ] Decoding test
 	else
+		# Command to run stored as a variable
 		cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout -"
-		echo "### DECODE $name #######################################################" >> ./streams.log
-		echo "###    cmd=$cmd" >> ./streams.log
-		cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name"
+
+		# Print out operation to run into log
+		printf "%s\n" "=== DECODE:  '$name' =======================================================" >> ./streams.log
+		printf "%s\n" "=== COMMAND: '$cmd" >> ./streams.log
+
+		# Run above command, sending STDERR to log
+		cat "${name}.flac" | $cmd 1>"${name}.cmp" 2>>./streams.log || die "ERROR: during decode of $name"
 	fi
-	ls -1l $name.raw >> ./streams.log
-	ls -1l $name.flac >> ./streams.log
-	ls -1l $name.cmp >> ./streams.log
 
-	echo -n "compare..."
-	cmp $name.raw $name.cmp || die "ERROR during compare of $name"
+	# Store each file's attributes into log
+	ls -1l "${name}.raw" >> ./streams.log
+	ls -1l "${name}.flac" >> ./streams.log
+	ls -1l "${name}.cmp" >> ./streams.log
+
+	# Print newline as separator to each file in log file
+	printf '\n' >> ./streams.log
+
+	# Print current operation
+	printf "Compare... "
+
+	# Compare both the 'raw' and 'cmp' FLAC byte by byte
+	cmp "${name}.raw" "${name}.cmp" || die "ERROR: during compare of $name"
 
-	echo OK
+	# Everything is OK for current FLAC
+	printf "OK\n\n"
 }
 
+################
+#  BEGIN TEST  #
+################
+
+# Find where `flac' and `valgrind' are located in $PATH
+flac_binary="$(command -v flac)"
+valgrind_binary="$(command -v valgrind)"
+
+# Test for `flac' executable, exiting if not found
+[ -n "${flac_binary}" ] || die "ERROR can't find flac \`flac' executable"
+
+# Print current operation
+printf "Generating streams...\n"
+
+# Test if 'wacky1.wav' doesn't exist
+if [ ! -f wacky1.wav ] ; then
+	# 'wacky1.wav' doesn't exist, so run `test_streams'
+	test_streams || die "ERROR during test_streams"
+fi
+
+# If FLAC__TEST_LEVEL is set to greater than 1, set a high lpc
 if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
 	max_lpc_order=32
 else
 	max_lpc_order=16
 fi
 
-echo "Testing noise through pipes..."
+# Print current operation
+printf "Testing noise through pipes...\n"
+
+# Test encoding/decoding noise via pipe, with positional parameters specified
 test_file_piped noise 1 8 "-0"
 
-echo "Testing small files..."
+# Print current operation
+printf "Testing small files...\n"
+
+# Test encoding/decoding with various FLAC streams
 test_file test01 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
 test_file test02 2 16 "-0 -l $max_lpc_order --lax -m -e -p"
 test_file test03 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
 test_file test04 2 16 "-0 -l $max_lpc_order --lax -m -e -p"
 
+# Run through various files with various bits-per-samples (created from
+# `test_streams')
 for bps in 8 16 24 ; do
-	echo "Testing $bps-bit full-scale deflection streams..."
+	# Print current operation
+	printf "Testing $bps-bit full-scale deflection streams...\n"
+
+	# Run through various files (created from `test_streams')
 	for b in 01 02 03 04 05 06 07 ; do
-		test_file fsd$bps-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e -p"
+		# Test encoding/decoding on each file with configured arguments
+		test_file "fsd$bps-$b" 1 "$bps" "-0 -l $max_lpc_order --lax -m -e -p"
 	done
 done
 
-echo "Testing 16-bit wasted-bits-per-sample streams..."
+# Print current operation
+printf "Testing 16-bit wasted-bits-per-sample streams...\n"
+
+# Run through various files (created from `test_streams')
 for b in 01 ; do
+	# Test encoding/decoding on each file with configured arguments
 	test_file wbps16-$b 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
 done
 
+# Run through various files (created from `test_streams'), testing the
+# encoding/decoding process with various channels, bits-per-samples, and sample
+# rates
 for bps in 8 16 24 ; do
-	echo "Testing $bps-bit sine wave streams..."
+	# Print current operation
+	printf "Testing $bps-bit sine wave streams...\n"
+
+	# For each file specified, run test
 	for b in 00 ; do
-		test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
+		# Test encoding/decoding on each file with configured arguments
+		test_file "sine${bps}-$b" 1 "$bps" "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
 	done
+
+	# For each file specified, run test
 	for b in 01 ; do
-		test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
+		# Test encoding/decoding on each file with configured arguments
+		test_file "sine${bps}-$b" 1 "$bps" "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
 	done
+
+	# For each file specified, run test
 	for b in 02 03 04 ; do
-		test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e"
+		# Test encoding/decoding on each file with configured arguments
+		test_file "sine${bps}-$b" 1 "$bps" "-0 -l $max_lpc_order --lax -m -e"
 	done
+
+	# For each file specified, run test
 	for b in 10 11 ; do
-		test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
+		# Test encoding/decoding on each file with configured arguments
+		test_file "sine${bps}-$b" 2 "$bps" "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
 	done
+
+	# For each file specified, run test
 	for b in 12 ; do
-		test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
+		# Test encoding/decoding on each file with configured arguments
+		test_file "sine${bps}-$b" 2 "$bps" "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
 	done
+
+	# For each file specified, run test
 	for b in 13 14 15 16 17 18 19 ; do
-		test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e"
+		# Test encoding/decoding on each file with configured arguments
+		test_file "sine${bps}-$b" 2 "$bps" "-0 -l $max_lpc_order --lax -m -e"
 	done
 done
 
-echo "Testing blocksize variations..."
+# Print current operation
+printf "Testing blocksize variations...\n"
+
+# Run the specified files through various blocksize tests by disabling all the
+# different types of subframes
 for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
+
+	# Run through the various blocksizes, testing each size
 	for blocksize in 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
+
+		# Run trough the various sizes of 'lpc_order', testing each size
 		for lpc_order in 0 1 2 3 4 5 7 8 9 15 16 17 31 32 ; do
+
+			# If 'lpc_order' is 0 or less than the specified blocksize, test
+			# the current file, 'noise8m32' with the current loops parameters
 			if [ $lpc_order = 0 ] || [ $lpc_order -le $blocksize ] ; then
+				# Test encoding/decoding on each file with configured arguments
 				test_file noise8m32 1 8 "-8 -p -e -l $lpc_order --lax --blocksize=$blocksize $disable"
 			fi
 		done
 	done
 done
 
-echo "Testing some frame header variations..."
+# Print current operation
+printf "Testing some frame header variations...\n"
+
+# Test encoding/decoding on the specified file, 'sine16-01', with various header
+# variations
 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b $max_lpc_order"
 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b 65535"
 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=9"
@@ -208,60 +378,159 @@
 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90"
 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90000"
 
-echo "Testing option variations..."
+# Print current operation
+printf "Testing option variations...\n"
+
+#-----------#
+# 1 Channel #
+#-----------#
+# For each file specified below in 'sine16-0[:digit]', test the
+# encoding/decoding of each file with various arguments
 for f in 00 01 02 03 04 ; do
+
+	# Run through the various types of subframes
 	for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
+
+		# If there are subframes disabled, _OR_ if FLAC__TEST_LEVEL is _NOT_
+		# zero, continue on, else go to next iteration/loop
 		if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
+
+			# Run through the various levels of compression (specified via
+			# 'opt')
 			for opt in 0 1 2 4 5 6 8 ; do
+
+				# Run through the various exhaustive options during the tests
+				# for each file specified
 				for extras in '' '-p' '-e' ; do
-					if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
-						test_file sine16-$f 1 16 "-$opt $extras $disable"
+
+					# If there are _NO_ extras enabled, _OR_ if FLAC__TEST_LEVEL
+					# is _NOT_ zero, continue on to the exhaustive test below,
+					# else go to next iteration/loop
+					if [ -z "$extras" ] || [ $FLAC__TEST_LEVEL -gt 0 ] ; then
+						# Test encoding/decoding on the specified file, with
+						# some of the exhaustive options enabled
+						test_file "sine16-$f" 1 16 "-$opt $extras $disable"
 					fi
 				done
 			done
-			if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
-				test_file sine16-$f 1 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
+
+			# If FLAC__TEST_LEVEL is greater than '1', run the most exhaustive
+			# test with various subframes enabled/disabled
+			if [ $FLAC__TEST_LEVEL -gt 1 ] ; then
+				# Test encoding/decoding on the specified file, with all the
+				# exhaustive extras
+				test_file "sine16-$f" 1 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
 			fi
 		fi
 	done
 done
 
+#------------#
+# 2 Channels #
+#------------#
+# For each file specified below in 'sine16-0[:digit]', test the
+# encoding/decoding of each file with various arguments
 for f in 10 11 12 13 14 15 16 17 18 19 ; do
+
+	# Run through the various types of subframes
 	for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
+
+		# If there are subframes disabled, _OR_ if FLAC__TEST_LEVEL is _NOT_
+		# zero, continue on, else go to next iteration/loop
 		if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
+
+			# Run through the various levels of compression (specified via
+			# 'opt')
 			for opt in 0 1 2 4 5 6 8 ; do
+
+				# Run through the various exhaustive options during the tests
+				# for each file specified
 				for extras in '' '-p' '-e' ; do
-					if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
-						test_file sine16-$f 2 16 "-$opt $extras $disable"
+
+					# If there are _NO_ extras enabled, _OR_ if FLAC__TEST_LEVEL
+					# is _NOT_ zero, continue on to the exhaustive test below,
+					# else go to next iteration/loop
+					if [ -z "$extras" ] || [ $FLAC__TEST_LEVEL -gt 0 ] ; then
+						# Test encoding/decoding on the specified file, with
+						# some of the exhaustive options enabled
+						test_file "sine16-$f" 2 16 "-$opt $extras $disable"
 					fi
 				done
 			done
-			if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
-				test_file sine16-$f 2 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
+
+			# If FLAC__TEST_LEVEL is greater than '1', run the most exhaustive
+			# test with various subframes enabled/disabled
+			if [ $FLAC__TEST_LEVEL -gt 1 ] ; then
+				# Test encoding/decoding on the specified file, with all the
+				# exhaustive extras
+				test_file "sine16-$f" 2 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
 			fi
 		fi
 	done
 done
 
-echo "Testing noise..."
+#-------#
+# Noise #
+#-------#
+# Test the encoding/decoding of 'noise' file with various arguments/options
+
+# Print current operation
+printf "Testing noise - option variations...\n"
+
+# Run through the various type of subframes
 for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
+
+	# If there are subframes disabled, _OR_ if FLAC__TEST_LEVEL is _NOT_ zero,
+	# continue on, else go to next iteration/loop
 	if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
+
+		# Run through the various channels set as '$2' in the following test
+		# command
 		for channels in 1 2 4 8 ; do
-			if [ $channels -le 2 ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
+
+			# If the channels of the current FLAC file is less than '3', _OR_
+			# FLAC__TEST_LEVEL is greater than '0', continue on, else go to next
+			# iteration/loop
+			if [ $channels -le 2 ] || [ $FLAC__TEST_LEVEL -gt 0 ] ; then
+
+				# Run through the various bits-per-sample set as '$3' in the
+				# following test command
 				for bps in 8 16 24 ; do
+
+					# Run through the various levels of compression (specified
+					# via 'opt')
 					for opt in 0 1 2 3 4 5 6 7 8 ; do
+
+						# Run through the various exhaustive options during the
+						# tests for file specified
 						for extras in '' '-p' '-e' ; do
+
+							# If there are _NO_ extras enabled, _OR_ if
+							# FLAC__TEST_LEVEL is _NOT_ zero, continue on, else
+							# go to next iteration/loop
 							if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
+
+								# Run through various blocksizes to test with on
+								# the 'noise' file below
 								for blocksize in '' '--lax -b 32' '--lax -b 32768' '--lax -b 65535' ; do
 									if [ -z "$blocksize" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
-										test_file noise $channels $bps "-$opt $extras $blocksize $disable"
+										# Test encoding/decoding on the 'noise'
+										# file, with various arguments/options
+										# enabled
+										test_file noise "$channels" "$bps" "-$opt $extras $blocksize $disable"
 									fi
 								done
 							fi
 						done
 					done
-					if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
-						test_file noise $channels $bps "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
+
+					# If FLAC__TEST_LEVEL is greater than '1', run the most
+					# exhaustive test without testing compression, exhaustive
+					# options, and blocksizes
+					if [ $FLAC__TEST_LEVEL -gt 1 ] ; then
+						# Test encoding/decoding on the specified file, without
+						# the above arguments/options
+						test_file noise "$channels" "$bps" "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
 					fi
 				done
 			fi
