<commit_before>var assert = require('chai').assert,
    mkrand = require('../lib/mkrand');

suite('mkrandのテスト', function() {

  test('"X"の数だけ0-9a-zA-Zのランダムな文字列に置換されること', function() {
    var randomString = mkrand('XXXXX');

    assert.isTrue(/^[\da-zA-Z]{5}$/.test(randomString),
        'replace to random string from "XXXXX"');
    assert.notStrictEqual(randomString, 'XXXXX',
        'randomString is not "XXXXX"');
  });

  test('"X"が複数ある場合、末尾の"X"が優先的に置換されること', function() {
    var randomString = mkrand('XXXXX_XXXXX');

    assert.isTrue(/^X{5}_[\da-zA-Z]{5}$/.test(randomString),
        'replace to random string from XXXXX');
    assert.notStrictEqual(randomString, 'XXXXX_XXXXX',
        'randomString is not "XXXXX_XXXXX"');
  });

  test('"X"が末尾で無くても置換されること', function() {
    var randomString = mkrand('temp-XXXXX.tmp');

    assert.isTrue(/^temp-[\da-zA-Z]{5}\.tmp$/.test(randomString),
        'replace to random string from temp-XXXXX.tmp');
    assert.notStrictEqual(randomString, 'temp-XXXXX.tmp',
        'randomString is not "temp-XXXXX.tmp"');
  });

  test('"X"が無い場合置換されないこと', function() {
    assert.strictEqual(mkrand('abcdef'), 'abcdef',
        'randomString is not replaced');
  });

});<commit_msg>rewrote unit test of mkrand<commit_after>var assert = require('chai').assert,
    mkrand = require('../lib/mkrand');

suite('mkrand()', function() {

  test('replace "X" in end of line', function() {
    var str = mkrand('XXXXX_XXXXX');

    assert.isTrue(
        /^X{5}_[\da-zA-Z]{5}$/.test(str),
        'str should be match in /^X{5}_[\\da-zA-Z]{5}$/');
    assert.notStrictEqual(
        str,
        'XXXXX_XXXXX',
        'str should not be "XXXXX_XXXXX"');
  });

  test('replace "X" in near end of line', function() {
    var str = mkrand('temp-XXXXX.tmp');

    assert.isTrue(
        /^temp-[\da-zA-Z]{5}\.tmp$/.test(str),
        'str should be match in /^temp-[\\da-zA-Z]{5}\\.tmp$/');
    assert.notStrictEqual(
        str,
        'temp-XXXXX.tmp',
        'str should not be "temp-XXXXX.tmp"');
  });

  test('not replace if string not has "X"', function() {
    assert.strictEqual(
        mkrand('abcde'),
        'abcde',
        'mkrand("abcde") should be returned "abcde"');
  });

});
{'fraction_non_alphanumeric': 0.19570085087326466, 'fraction_numerical': 0.005373936408419167, 'mean_word_length': 3.0915750915750917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1262595', 'n_tokens_mistral': 872, 'n_tokens_neox': 834, 'n_words': 149}