<commit_before>#!/usr/bin/env sh

source test/helper.sh

nothing_to_do_test() {
  rm -fr tmp
  mkdir tmp

  content_of_size 0 >tmp/0.txt
  assert_file_exists 'tmp/0.txt'

  local command='./euthanize --size 0 tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'

  local command='./euthanize --size 1 tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'

  mkdir tmp/byte
  content_of_size 1 >tmp/byte/1-byte.txt
  assert_file_exists 'tmp/byte/1-byte.txt'

  local command='./euthanize --size 1 tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'
  assert_file_exists 'tmp/byte/1-byte.txt'

  mkdir tmp/byte/kb
  content_of_size 1000 >tmp/byte/kb/1-kb.txt
  assert_file_exists 'tmp/byte/kb/1-kb.txt'

  local command='./euthanize --size 2KB tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'
  assert_file_exists 'tmp/byte/1-byte.txt'
  assert_file_exists 'tmp/byte/kb/1-kb.txt'

  rm -fr tmp
}
nothing_to_do_test
<commit_msg>Expand coverage of situations in which there is nothing to be done<commit_after>#!/usr/bin/env sh

source test/helper.sh

nothing_to_do_test() {
  content_of_size 0 >0.txt
  assert_file_exists '0.txt'
  local command='./euthanize --size 0 0.txt'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists '0.txt'
  rm 0.txt

  content_of_size 4 >4.txt
  assert_file_exists '4.txt'
  local command='./euthanize --size 8 4.txt'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists '4.txt'
  rm 4.txt

  rm -fr tmp
  mkdir tmp

  content_of_size 0 >tmp/0.txt
  assert_file_exists 'tmp/0.txt'

  local command='./euthanize --size 0 tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'

  local command='./euthanize --size 1 tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'

  mkdir tmp/byte
  content_of_size 1 >tmp/byte/1-byte.txt
  assert_file_exists 'tmp/byte/1-byte.txt'

  local command='./euthanize --size 1 tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'
  assert_file_exists 'tmp/byte/1-byte.txt'

  mkdir tmp/byte/kb
  content_of_size 1000 >tmp/byte/kb/1-kb.txt
  assert_file_exists 'tmp/byte/kb/1-kb.txt'

  local command='./euthanize --size 2KB tmp'
  assert_output_equal 'Nothing to do.' "$command"
  assert_exit_status_equal 0 "$command"
  assert_file_exists 'tmp/0.txt'
  assert_file_exists 'tmp/byte/1-byte.txt'
  assert_file_exists 'tmp/byte/kb/1-kb.txt'

  rm -fr tmp
}
nothing_to_do_test

{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.023529411764705882, 'mean_word_length': 4.01010101010101, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6808890', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1105, 'n_words': 253}