<commit_before>#! /bin/sh
# $Id$
# vim:et:ft=sh:sts=2:sw=2
#
# Copyright 2008 <NAME>. All Rights Reserved.
# Released under the LGPL (GNU Lesser General Public License)
#
# Author: <EMAIL> (<NAME>)
#
# shUnit2 unit test for macros

# load test helpers
. ./shunit2_test_helpers

#------------------------------------------------------------------------------
# suite tests
#

testLineNo()
{
  # start skipping if LINENO not available
  [ -z "${LINENO:-}" ] && startSkipping

  ### asserts

  ( ${_ASSERT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_EQUALS_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_NOT_EQUALS_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NOT_EQUALS_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_NULL_} 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NULL_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_NOT_NULL_} '' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NOT_NULL_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_NOT_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NOT_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_TRUE_} ${SHUNIT_FALSE} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_TRUE_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_FALSE_} ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_FALSE_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_ASSERT_FALSE_} ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_FALSE_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ### failures

  ( ${_FAIL_} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_FAIL_NOT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_NOT_EQUALS_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_FAIL_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2

  ( ${_FAIL_NOT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_NOT_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat ${stderrF} >&2
}

#------------------------------------------------------------------------------
# suite functions
#

oneTimeSetUp()
{
  tmpDir="${__shunit_tmpDir}/output"
  mkdir "${tmpDir}"
  stdoutF="${tmpDir}/stdout"
  stderrF="${tmpDir}/stderr"
}

# load and run shUnit2
[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
. ${TH_SHUNIT}
<commit_msg>added quotes around cat '' calls<commit_after>#! /bin/sh
# $Id$
# vim:et:ft=sh:sts=2:sw=2
#
# Copyright 2008 <NAME>. All Rights Reserved.
# Released under the LGPL (GNU Lesser General Public License)
#
# Author: <EMAIL> (<NAME>)
#
# shUnit2 unit test for macros

# load test helpers
. ./shunit2_test_helpers

#------------------------------------------------------------------------------
# suite tests
#

testLineNo()
{
  # start skipping if LINENO not available
  [ -z "${LINENO:-}" ] && startSkipping

  ### asserts

  ( ${_ASSERT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_EQUALS_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_NOT_EQUALS_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NOT_EQUALS_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_NULL_} 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NULL_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_NOT_NULL_} '' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NOT_NULL_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_NOT_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_NOT_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_TRUE_} ${SHUNIT_FALSE} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_TRUE_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_FALSE_} ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_FALSE_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_ASSERT_FALSE_} ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_ASSERT_FALSE_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ### failures

  ( ${_FAIL_} >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_FAIL_NOT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_NOT_EQUALS_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_FAIL_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2

  ( ${_FAIL_NOT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
  grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
  rtrn=$?
  assertTrue '_FAIL_NOT_SAME_ failure' ${rtrn}
  [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}">&2
}

#------------------------------------------------------------------------------
# suite functions
#

oneTimeSetUp()
{
  tmpDir="${__shunit_tmpDir}/output"
  mkdir "${tmpDir}"
  stdoutF="${tmpDir}/stdout"
  stderrF="${tmpDir}/stderr"
}

# load and run shUnit2
[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
. ${TH_SHUNIT}

{'fraction_non_alphanumeric': 0.2980340760157274, 'fraction_numerical': 0.016251638269986893, 'mean_word_length': 3.561267184698147, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 113, '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': '7578899', 'n_tokens_mistral': 3279, 'n_tokens_neox': 3262, 'n_words': 617}