<commit_before># unit_tests.sh
#
# Set of unit test for bhist library. 
# 
# Require:
#
#  environment variables:
#    BHIST_USER=user
#    BHIST_HOME=/home/user
#    BHIST_FILENAME=<bhist_filename>
#  
#  user/group: user/user
#  location: /home/buser


# Helper

die() {
  >&2 echo "ERROR: $1 !"
  exit 1
}


# Define functions to use the script ./test_suite.

init_test_suite() {

  # Check environment
  [[ "$USER" == "$BHIST_USER" ]] || die "current user should be '$BHIST_USER'"
  [[ -d "$BHIST_HOME" ]] || die "'$BHIST_HOME' does not exist or is not a folder"
  [[ "$HOME" == "$BHIST_HOME" ]] || die "$HOME should be '$BHIST_HOME'"
  
  [[ -n $BHIST_FILENAME ]] || die "environment variable BHIST_FILENAME is not defined"
  BHIST_FILENAME="$(realpath "$BHIST_FILENAME")"
  [[ -f $BHIST_FILENAME ]] || die "'$BHIST_FILENAME' does not exist or is not a file"
  
  # Init environment
  cd "$BHIST_HOME" || die "impossible to go to '$BHIST_HOME'"
  echo "go to $PWD"

  mkdir -vp {A,B,C}/{1,2,3} D/{:2,+,-,:-1} E/ "F F/" || die "impossible to create filesystem environment"
  chmod -v -x E || die "impossible to change permissions for 'E' folder"

  # Enable browsing history
  source "$BHIST_FILENAME" || die "impossible to import '$BHIST_FILENAME' in bash environment"

}

clean_test_suite() {

  rm -rfv "$BHIST_HOME"/{A,B,C,D,E,"F F"}
  
}
<commit_msg>Update unit_tests.sh<commit_after># unit_tests.sh
#
# Set of unit test for bhist library. 
# 
# Require:
#
#  environment variables:
#    BHIST_USER=user
#    BHIST_HOME=/home/user
#    BHIST_FILENAME=<bhist_filename>
#  
#  user/group: user/user
#  location: /home/buser


# Helper

die() {
  >&2 echo "ERROR: $1 !"
  exit 1
}


# Define functions to use the script ./test_suite.

init_test_suite() {

  # Check environment
  [[ -n $BHIST_USER ]] || die "environment variable BHIST_USER is not defined"
  [[ "$USER" == "$BHIST_USER" ]] || die "current user should be '$BHIST_USER'"
  
  [[ -n $BHIST_HOME ]] || die "environment variable BHIST_HOME is not defined"
  [[ -d "$BHIST_HOME" ]] || die "'$BHIST_HOME' does not exist or is not a folder"
  [[ "$HOME" == "$BHIST_HOME" ]] || die "home should be '$BHIST_HOME'"
  
  [[ -n $BHIST_FILENAME ]] || die "environment variable BHIST_FILENAME is not defined"
  BHIST_FILENAME="$(realpath "$BHIST_FILENAME")"
  [[ -f $BHIST_FILENAME ]] || die "'$BHIST_FILENAME' does not exist or is not a file"
  
  # Init environment
  cd "$BHIST_HOME" || die "impossible to go to '$BHIST_HOME'"
  echo "go to $PWD"

  mkdir -vp {A,B,C}/{1,2,3} D/{:2,+,-,:-1} E/ "F F/" || die "impossible to create filesystem environment"
  chmod -v -x E || die "impossible to change permissions for 'E' folder"

  # Enable browsing history
  source "$BHIST_FILENAME" || die "impossible to import '$BHIST_FILENAME' in bash environment"

}

clean_test_suite() {

  rm -rfv "$BHIST_HOME"/{A,B,C,D,E,"F F"}
  
}

{'fraction_non_alphanumeric': 0.15944540727902945, 'fraction_numerical': 0.005545927209705373, 'mean_word_length': 3.762376237623762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '307213', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1069, 'n_words': 307}