<commit_before>#!/bin/bash

# Find the directory that this test script belongs to.
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Check if this test script is being used to compute coverage information.
if [ $(basename $1) = "coverage" ]; then
  cov=1
else
  cov=0
fi

# Performs the necessary setup for all positive test cases.
start_pos()
{
  if [ $cov = 0 ]; then
    ulimit -t 2
  fi
  cp $DIR/unittab $PWD/unittab
}

# Performs the necessary setup for all negative test cases.
start_neg()
{
  if [ $cov = 0 ]; then
    ulimit -t 1
  else
    ulimit -t 10
  fi
  cp $DIR/unittab $PWD/unittab
}

end_pos()
{
  if [ ! $DIR = $PWD ]; then
    rm $PWD/unittab
  fi
}

end_neg() 
{
  if [ ! $DIR = $PWD ]; then
    rm $PWD/unittab
  fi
}

# Execute the appropriate test case.
case $2 in
  p1)
    start_pos
    bash -c "$1 < $DIR/test/t1" |& diff $DIR/test/output.t1 -
    result=$?
    end_pos
    exit $result;;

  p2)
    start_pos
    bash -c "$1 < $DIR/test/t2" |& diff $DIR/test/output.t2 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  p3)
    start_pos
    bash -c "$1 < $DIR/test/t3" |& diff $DIR/test/output.t3 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  p4)
    start_pos
    bash -c "$1 < $DIR/test/t4" |& diff $DIR/test/output.t4 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  p5)
    start_pos
    bash -c "$1 < $DIR/test/t5" |& diff $DIR/test/output.t5 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  n1)
    start_neg
    bash -c "$1 < $DIR/test/bad1" &> /dev/null
    result=$?
    end_neg
    exit $result;;
esac 
exit 1<commit_msg>Finished tweaking units benchmark.<commit_after>#!/bin/bash

# Find the directory that this test script belongs to.
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Check if this test script is being used to compute coverage information.
if [ $(basename $1) = "coverage" ]; then
  cov=1
else
  cov=0
fi

# Performs the necessary setup for all positive test cases.
start_pos()
{
  if [ $cov = 0 ]; then
    ulimit -t 2
  fi
  cp $DIR/unittab $PWD/unittab
}

# Performs the necessary setup for all negative test cases.
start_neg()
{
  if [ $cov = 0 ]; then
    ulimit -t 1
  else
    ulimit -t 10
  fi
  cp $DIR/unittab $PWD/unittab
}

end_pos()
{
  if [ ! $DIR = $PWD ]; then
    rm $PWD/unittab
  fi
}

end_neg() 
{
  if [ ! $DIR = $PWD ]; then
    rm $PWD/unittab
  fi
}

# Execute the appropriate test case.
case $2 in
  p1)
    start_pos
    bash -c "$1 < $DIR/test/t1" |& diff $DIR/test/output.t1 -
    result=$?
    end_pos
    exit $result;;

  p2)
    start_pos
    bash -c "$1 < $DIR/test/t2" |& diff $DIR/test/output.t2 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  p3)
    start_pos
    bash -c "$1 < $DIR/test/t3" |& diff $DIR/test/output.t3 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  p4)
    start_pos
    bash -c "$1 < $DIR/test/t4" |& diff $DIR/test/output.t4 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  p5)
    start_pos
    bash -c "$1 < $DIR/test/t5" |& diff $DIR/test/output.t5 - &> /dev/null
    result=$?
    end_pos
    exit $result;;

  n1)
    start_neg
    $1 < $DIR/test/bad1 &> /dev/null # this doesn't seem to work?
    result=$?
    end_neg
    exit $result;;
esac 
exit 1
{'fraction_non_alphanumeric': 0.15115571776155717, 'fraction_numerical': 0.021289537712895375, 'mean_word_length': 2.3022088353413657, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '2065158', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1335, 'n_words': 373}