<commit_before>#!/bin/sh
# Check for proper function of command line arguments and general
# unix shell functionality.

# Check for correct number of arguments
if test $# -lt 1
then
    echo 'Usage: test_command_line.sh prolog' 1>&2
    echo 'Example:' 1>&2
    echo '    test_command_line.sh ./alspro' 1>&2
    exit 2
fi

echo "Starting Command Line Tests"

prolog=$1

# Set ALS_OPTIONS to the empty string so $prolog will use defaults.
ALS_OPTIONS=
export ALS_OPTIONS

error_count=0


error () {
	command=$1
	expected_result=$2
	result=$3
	echo
    echo "Command Line Test Error:"
    echo "  Command: $command"
    echo "  Expected Result: $expected_result But got: $result"
    echo
    error_count=`expr $error_count + 1`
}

cl_test () {
    command=$1
    expected_result=$2

    echo "testing: $command"
    eval $command
    result=$?
    if test $result -ne $expected_result
    then
        error "$command" "$expected_result" "$result"
    fi
}

opt_test () {
    options=$1
    command=$2
    expected_result=$3

    echo "testing: ALS_OPTIONS=$1 ;  $command"
    ALS_OPTIONS=$1
    eval $command
    result=$?
    if test $result -ne $expected_result
    then
        error "ALS_OPTIONS=$1 ; $command" "$expected_result" "$result"
    fi
}

# Test -q (quiet) argument.

command="$prolog -q < /dev/null"
output=`eval $command`

if test "$output" != ""
then
	error "$command" "" "$output"
fi

# Test -b (batch) argument.

command="$prolog -b"
output=`eval $command`

if test "$output" = ""
then
	error "$command" "ALS Prolog..." "$output"
fi

# Test -q and -b together.

command="$prolog -q -b"
output=`eval $command`

if test "$output" != ""
then
	error "$command" "" "$output"
fi


# test success/fail/exception return values for -b -g options

cl_test "$prolog -q -b -g true" 0<commit_msg>Adjust command-line test to expect prompt on windows<commit_after>#!/bin/sh
# Check for proper function of command line arguments and general
# unix shell functionality.

# Check for correct number of arguments
if test $# -lt 1
then
    echo 'Usage: test_command_line.sh prolog' 1>&2
    echo 'Example:' 1>&2
    echo '    test_command_line.sh ./alspro' 1>&2
    exit 2
fi

echo "Starting Command Line Tests"

prolog=$1

# Set ALS_OPTIONS to the empty string so $prolog will use defaults.
ALS_OPTIONS=
export ALS_OPTIONS

error_count=0


error () {
	command=$1
	expected_result=$2
	result=$3
	echo
    echo "Command Line Test Error:"
    echo "  Command: $command"
    echo "  Expected Result: $expected_result But got: $result"
    echo
    error_count=`expr $error_count + 1`
}

cl_test () {
    command=$1
    expected_result=$2

    echo "testing: $command"
    eval $command
    result=$?
    if test $result -ne $expected_result
    then
        error "$command" "$expected_result" "$result"
    fi
}

opt_test () {
    options=$1
    command=$2
    expected_result=$3

    echo "testing: ALS_OPTIONS=$1 ;  $command"
    ALS_OPTIONS=$1
    eval $command
    result=$?
    if test $result -ne $expected_result
    then
        error "ALS_OPTIONS=$1 ; $command" "$expected_result" "$result"
    fi
}

# Test -q (quiet) argument.

case $(uname) in
	"CYGWIN"*)	expected_output="?- " ;;
	        *) 	expected_output=""    ;;
esac

command="$prolog -q < /dev/null"
output=`eval $command`

if test "$output" != "$expected_output"
then
	error "$command" "$expected_output" "$output"
fi

# Test -b (batch) argument.

command="$prolog -b"
output=`eval $command`

if test "$output" = ""
then
	error "$command" "ALS Prolog..." "$output"
fi

# Test -q and -b together.

command="$prolog -q -b"
output=`eval $command`

if test "$output" != ""
then
	error "$command" "" "$output"
fi


# test success/fail/exception return values for -b -g options

cl_test "$prolog -q -b -g true" 0
{'fraction_non_alphanumeric': 0.13245033112582782, 'fraction_numerical': 0.012185430463576159, 'mean_word_length': 3.2811791383219955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3305983', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1270, 'n_words': 409}