var Benchtable = require('benchtable');

var penner = require('easing-js');
var gml = require('./gml');
var opts = require( './benchmark_opts' );

var suite = {};

suite.constructors = {
  cubicInOut: new Benchtable(),
  quadraticInOut: new Benchtable(),
  trigInOut: new Benchtable(),
  expInOut: new Benchtable(),
  backInOut: new Benchtable(),
};

suite.constructors.cubicInOut
  .addFunction( 'CubicInOut', input => { gml.Easing.CubicInOut( input[0] ); }, opts )
  .addFunction( '(penner) CubicInOut', input => { penner.easeInOutCubic( input[0], 0, 1, 1 ); }, opts )
  .addInput( 'random t 1', [ Math.random() ] )
  .addInput( 'random t 2', [ Math.random() ] )
  .addInput( 'random t 3', [ Math.random() ] )
  .addInput( 'random t 4', [ Math.random() ] )
  .on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').pluck('name'));
    console.log(this.table.toString());
  }) 
  .run();

suite.constructors.quadraticInOut
  .addFunction( 'QuadraticInOut', input => { gml.Easing.QuadInOut( input[0] ); }, opts )
  .addFunction( '(penner) easeInOutQuad', input => { penner.easeInOutQuad( input[0], 0, 1, 1 ); }, opts )
  .addInput( 'random t 1', [ Math.random() ] )
  .addInput( 'random t 2', [ Math.random() ] )
  .addInput( 'random t 3', [ Math.random() ] )
  .addInput( 'random t 4', [ Math.random() ] )
  .on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').pluck('name'));
    console.log(this.table.toString());
  }) 
  .run();

suite.constructors.trigInOut
  .addFunction( 'TrigInOut', input => { gml.Easing.TrigInOut( input[0] ); }, opts )
  .addFunction( '(penner) easeInOutSine', input => { penner.easeInOutSine( input[0], 0, 1, 1 ); }, opts )
  .addInput( 'random t 1', [ Math.random() ] )
  .addInput( 'random t 2', [ Math.random() ] )
  .addInput( 'random t 3', [ Math.random() ] )
  .addInput( 'random t 4', [ Math.random() ] )
  .on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').pluck('name'));
    console.log(this.table.toString());
  }) 
  .run();

suite.constructors.expInOut
  .addFunction( 'ExpInOut', input => { gml.Easing.ExpInOut( input[0] ); }, opts )
  .addFunction( '(penner) easeInOutExpo', input => { penner.easeInOutExpo( input[0], 0, 1, 1 ); }, opts )
  .addInput( 'random t 1', [ Math.random() ] )
  .addInput( 'random t 2', [ Math.random() ] )
  .addInput( 'random t 3', [ Math.random() ] )
  .addInput( 'random t 4', [ Math.random() ] )
  .on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').pluck('name'));
    console.log(this.table.toString());
  }) 
  .run();

suite.constructors.backInOut
  .addFunction( 'BackInOut', input => { gml.Easing.BackInOut( input[0] ); }, opts )
  .addFunction( '(penner) easeInOutBack', input => { penner.easeInOutBack( input[0], 0, 1, 1 ); }, opts )
  .addInput( 'random t 1', [ Math.random() ] )
  .addInput( 'random t 2', [ Math.random() ] )
  .addInput( 'random t 3', [ Math.random() ] )
  .addInput( 'random t 4', [ Math.random() ] )
  .on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').pluck('name'));
    console.log(this.table.toString());
  }) 
  .run();

@@ -163,28 +163,20 @@
 %0A%0Asuite.
-constructors
+ease
  = %7B%0A  c
@@ -342,28 +342,20 @@
 %0A%0Asuite.
-constructors
+ease
 .cubicIn
@@ -771,79 +771,8 @@
 ) %7B%0A
-    console.log('Fastest is ' + this.filter('fastest').pluck('name'));%0A
     
@@ -830,28 +830,20 @@
 %0A%0Asuite.
-constructors
+ease
 .quadrat
@@ -1268,79 +1268,8 @@
 ) %7B%0A
-    console.log('Fastest is ' + this.filter('fastest').pluck('name'));%0A
     
@@ -1327,28 +1327,20 @@
 %0A%0Asuite.
-constructors
+ease
 .trigInO
@@ -1755,79 +1755,8 @@
 ) %7B%0A
-    console.log('Fastest is ' + this.filter('fastest').pluck('name'));%0A
     
@@ -1814,28 +1814,20 @@
 %0A%0Asuite.
-constructors
+ease
 .expInOu
@@ -2239,79 +2239,8 @@
 ) %7B%0A
-    console.log('Fastest is ' + this.filter('fastest').pluck('name'));%0A
     
@@ -2302,20 +2302,12 @@
 ite.
-constructors
+ease
 .bac
@@ -2683,32 +2683,32 @@
 th.random() %5D )%0A
+
   .on('complete'
@@ -2726,79 +2726,8 @@
 ) %7B%0A
-    console.log('Fastest is ' + this.filter('fastest').pluck('name'));%0A
     

clean up easing perf tests