<commit_before>#!/bin/bash

# check shunit
if [[ ! -x "./shunit2-2.1.6/src/shunit2" ]]; then
    curl -L "https://shunit2.googlecode.com/files/shunit2-2.1.6.tgz" | tar zx
    [[ "${?}" -ne 0 ]] && exit 1
fi


# test
function testMake() {
    make install PREFIX='.'
    assertEquals 0 $?

    [[ -x "./bin/renge" ]]
    assertEquals 0 $?

    [[ -e "./share/renge/renge-quotes" ]]
    assertEquals 0 $?
}

function testRengePrintUsage() {
    # short option
    ./bin/renge -h
    assertEquals 0 $?

    # long option
    ./bin/renge --help
    assertEquals 0 $?
}

function testRengePrintVersion() {
    # short option
    ./bin/renge -v
    assertEquals 0 $?

    # long option
    ./bin/renge --version
    assertEquals 0 $?
}

function testRengeIllegalOption() {
    # short option
    ./bin/renge -f
    assertEquals 255 $?

    # long option
    ./bin/renge --foobar
    assertEquals 255 $?
}

function testRengeTrueExit() {
    local rtn="$(./bin/renge)"
    assertNotNull "${rtn}"
    assertEquals 0 $?
}
<commit_msg>add test<commit_after>#!/bin/bash

# check shunit
if [[ ! -x "./shunit2-2.1.6/src/shunit2" ]]; then
    curl -L "https://shunit2.googlecode.com/files/shunit2-2.1.6.tgz" | tar zx
    [[ "${?}" -ne 0 ]] && exit 1
fi


# test
function testMake() {
    make install PREFIX='.'
    assertEquals 0 $?

    [[ -x "./bin/renge" ]]
    assertEquals 0 $?

    [[ -e "./share/renge/renge-quotes" ]]
    assertEquals 0 $?
}

function testRengePrintUsage() {
    # short option
    ./bin/renge -h
    assertEquals 0 $?

    # long option
    ./bin/renge --help
    assertEquals 0 $?
}

function testRengePrintVersion() {
    # short option
    ./bin/renge -v
    assertEquals 0 $?

    # long option
    ./bin/renge --version
    assertEquals 0 $?
}

function testRengeIllegalOption() {
    # short option
    ./bin/renge -f
    assertEquals 255 $?

    # long option
    ./bin/renge --foobar
    assertEquals 255 $?
}

function testRengeTrueExit() {
    local rtn="$(./bin/renge)"
    assertNotNull "${rtn}"
    assertEquals 0 $?
}

function testRengeTrueExitSpecifyQuoteNumber() {
    local rtn="$(./bin/renge -n 0)"
    assertEquals "${rtn}" "CMでは見たことあるのん！"
    assertEquals 0 $?

    local rtn="$(./bin/renge --number 0)"
    assertEquals "${rtn}" "CMでは見たことあるのん！"
    assertEquals 0 $?
}

function testRengeFalseExitIlligaQuoteNumber() {
    ./bin/renge -n 111111
    assertEquals 3 $?

    ./bin/renge -n ddddd
    assertEquals 3 $?
}

{'fraction_non_alphanumeric': 0.1602773246329527, 'fraction_numerical': 0.026101141924959218, 'mean_word_length': 2.3556771545827635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '7096833', 'n_tokens_mistral': 952, 'n_tokens_neox': 872, 'n_words': 199}