<commit_before>( function _FileProvider_HardDrive_test_ss_( ) {

'use strict';

if( typeof module !== 'undefined' )
{

  require( './aFileProvider.test.s' );

}

//

var _ = wTools;
var Parent = wTests[ 'FileProvider' ];

_.assert( Parent );

//

function makePath( filePath )
{
  filePath =  _.pathJoin( this.testRootDirectory,  filePath );
  return this.provider.pathNativize( filePath );
}

//

function pathsAreLinked( paths )
{
  var linked = true;
  var statsFirst = this.provider.fileStat( paths[ 0 ] );
  for( var i = 1; i < paths.length; i++ )
  {
    var statCurrent = this.provider.fileStat( paths[ i ] );
    linked &= _.statsAreLinked( statsFirst, statCurrent );
    if( !linked )
    break;
  }

  return linked;
}

//

function linkGroups( paths, groups )
{
  groups.forEach( ( g ) =>
  {
    if( g.length >= 2 )
    {
      var filePathes = g.map( ( i ) => paths[ i ] );
      this.provider.linkHard({ filePathes : filePathes });
    }
  })
}

//

function makeFiles( names, dirPath, data )
{
  var self = this;

  if( !_.arrayIs( data ) )
  data = _.arrayFillTimes( [], names.length, data );

  _.assert( data.length === names.length );

  var paths = names.map( ( p )  => self.makePath( _.pathJoin( dirPath, p ) ) );
  paths.forEach( ( p, i )  =>
  {
    if( self.provider.fileStat( p ) )
    self.provider.fileTouch({ filePath : p, purging : 1 });

    self.provider.fileWrite( p, data[ i ] )
  });

  return paths;
}

//

function makeTestDir( test )
{
  var self = this;
  self.testRootDirectory = _.dirTempMake( _.pathJoin( __dirname, '../..'  ) );
}

//

function cleanTestDir()
{
  var self = this;
  self.provider.fileDelete( self.testRootDirectory );
}

// --
// proto
// --

var Proto =
{

  name : 'FileProvider.HardDrive',
  abstract : 0,
  silencing : 1,

  onSuiteBegin : makeTestDir,
  onSuiteEnd : cleanTestDir,

  context :
  {
    provider : _.FileProvider.HardDrive(),
    makePath : makePath,
    makeFiles : makeFiles,
    pathsAreLinked : pathsAreLinked,
    linkGroups : linkGroups,
    makeTestDir : makeTestDir,
    testRootDirectory : null,
    testFile : null,
    // testRootDirectory : __dirname + '/../../../../tmp.tmp/hard-drive',
    // testFile : __dirname + '/../../../../tmp.tmp/hard-drive/test.txt',
  },

  tests :
  {
    // fileRenameSync : null,
  },

}

//

// var Self = new wTestSuite( Parent ).extendBy( Proto );
var Self = new wTestSuite( Proto ).inherit( Parent );
if( typeof module !== 'undefined' && !module.parent )
_.Tester.test( Self.name );

} )( );<commit_msg>few renames in hard drive tests<commit_after>( function _FileProvider_HardDrive_test_ss_( ) {

'use strict';

if( typeof module !== 'undefined' )
{

  require( './aFileProvider.test.s' );

}

//

var _ = wTools;
var Parent = wTests[ 'FileProvider' ];

_.assert( Parent );

//

function makePath( filePath )
{
  filePath =  _.pathJoin( this.testRootDirectory,  filePath );
  return this.provider.pathNativize( filePath );
}

//

function pathsAreLinked( paths )
{
  var linked = true;
  var statsFirst = this.provider.fileStat( paths[ 0 ] );
  for( var i = 1; i < paths.length; i++ )
  {
    var statCurrent = this.provider.fileStat( paths[ i ] );
    linked &= _.statsAreLinked( statsFirst, statCurrent );
    if( !linked )
    break;
  }

  return linked;
}

//

function linkGroups( paths, groups )
{
  groups.forEach( ( g ) =>
  {
    if( g.length >= 2 )
    {
      var filePathes = g.map( ( i ) => paths[ i ] );
      this.provider.linkHard({ filePathes : filePathes });
    }
  })
}

//

function makeFiles( names, dirPath, data )
{
  var self = this;

  if( !_.arrayIs( data ) )
  data = _.arrayFillTimes( [], names.length, data );

  _.assert( data.length === names.length );

  var paths = names.map( ( p )  => self.makePath( _.pathJoin( dirPath, p ) ) );
  paths.forEach( ( p, i )  =>
  {
    if( self.provider.fileStat( p ) )
    self.provider.fileTouch({ filePath : p, purging : 1 });

    self.provider.fileWrite( p, data[ i ] )
  });

  return paths;
}

//

function testDirMake( test )
{
  var self = this;
  self.testRootDirectory = _.dirTempMake( _.pathJoin( __dirname, '../..'  ) );
}

//

function testDirClean()
{
  var self = this;
  self.provider.fileDelete( self.testRootDirectory );
}

// --
// proto
// --

var Proto =
{

  name : 'FileProvider.HardDrive',
  abstract : 0,
  silencing : 1,

  onSuiteBegin : testDirMake,
  onSuiteEnd : testDirClean,

  context :
  {
    provider : _.FileProvider.HardDrive(),
    makePath : makePath,
    makeFiles : makeFiles,
    pathsAreLinked : pathsAreLinked,
    linkGroups : linkGroups,
    testDirMake : testDirMake,
    testRootDirectory : null,
    testFile : null,
    // testRootDirectory : __dirname + '/../../../../tmp.tmp/hard-drive',
    // testFile : __dirname + '/../../../../tmp.tmp/hard-drive/test.txt',
  },

  tests :
  {
    // fileRenameSync : null,
  },

}

//

// var Self = new wTestSuite( Parent ).extendBy( Proto );
var Self = new wTestSuite( Proto ).inherit( Parent );
if( typeof module !== 'undefined' && !module.parent )
_.Tester.test( Self.name );

} )( );
{'fraction_non_alphanumeric': 0.16541945647892872, 'fraction_numerical': 0.0023631350925561244, 'mean_word_length': 2.7018950437317786, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2557719', 'n_tokens_mistral': 1800, 'n_tokens_neox': 1756, 'n_words': 403}