<commit_before>function test(kind, width, height, speed, feed, _onFinish) {
  if (kind == 'random') {
    return random(width, height, speed, feed);
  } else if (kind == 'clock') {
    return clock(width, height, speed, feed);
  }
}

function random(width, height, speed, feed) {
  let intervalId;
  let t = 33 / (speed || 1.0);

  return {
    width: width || 80,
    height: height || 24,

    start: () => {
      intervalId = setInterval(() => {
        feed(Math.random().toString());
      }, t);
    },

    stop: () => {
      clearInterval(intervalId);
    }
  };
}

function clock(width, height, _speed, feed, _onFinish) {
  width = width || 5;
  height = height || 1;
  const middleRow = Math.floor(height / 2);
  const leftPad = Math.floor(width / 2) - 2;
  let intervalId;

  return {
    width: width,
    height: height,

    start: () => {
      setTimeout(() => {
        feed(`\x1b[?25l\x1b[1m\x1b[${middleRow}B`);
      }, 0);

      intervalId = setInterval(() => {
        const d = new Date();
        const h = d.getHours();
        const m = d.getMinutes();

        feed('\r');
        for (let i = 0; i < leftPad; i++) { feed(' ') }
        feed('\x1b[32m');
        if (h < 10) { feed('0') }
        feed(`${h}`);
        feed('\x1b[39;5m:\x1b[25;35m')
        if (m < 10) { feed('0') }
        feed(`${m}`);
      }, 1000);
    },

    stop: () => {
      clearInterval(intervalId);
    },

    getCurrentTime: () => {
      const d = new Date();

      return d.getHours() * 60 + d.getMinutes();
    }
  };
}

export { test };
<commit_msg>Make test clock driver return 24h as duration<commit_after>function test(kind, width, height, speed, feed, _onFinish) {
  if (kind == 'random') {
    return random(width, height, speed, feed);
  } else if (kind == 'clock') {
    return clock(width, height, speed, feed);
  }
}

function random(width, height, speed, feed) {
  let intervalId;
  let t = 33 / (speed || 1.0);

  return {
    width: width || 80,
    height: height || 24,

    start: () => {
      intervalId = setInterval(() => {
        feed(Math.random().toString());
      }, t);
    },

    stop: () => {
      clearInterval(intervalId);
    }
  };
}

function clock(width, height, _speed, feed, _onFinish) {
  width = width || 5;
  height = height || 1;
  const middleRow = Math.floor(height / 2);
  const leftPad = Math.floor(width / 2) - 2;
  let intervalId;

  return {
    width: width,
    height: height,
    duration: 24 * 60,

    start: () => {
      setTimeout(() => {
        feed(`\x1b[?25l\x1b[1m\x1b[${middleRow}B`);
      }, 0);

      intervalId = setInterval(() => {
        const d = new Date();
        const h = d.getHours();
        const m = d.getMinutes();

        feed('\r');
        for (let i = 0; i < leftPad; i++) { feed(' ') }
        feed('\x1b[32m');
        if (h < 10) { feed('0') }
        feed(`${h}`);
        feed('\x1b[39;5m:\x1b[25;35m')
        if (m < 10) { feed('0') }
        feed(`${m}`);
      }, 1000);
    },

    stop: () => {
      clearInterval(intervalId);
    },

    getCurrentTime: () => {
      const d = new Date();

      return d.getHours() * 60 + d.getMinutes();
    }
  };
}

export { test };

{'fraction_non_alphanumeric': 0.19272955186461924, 'fraction_numerical': 0.030084612973989344, 'mean_word_length': 2.1541501976284585, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '5124362', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1124, 'n_words': 268}