/**
 * Created by hustcc.
 * Contract: i@hust.cc
 */

var Benchmark = require('benchmark');
var suite = new Benchmark.Suite();

var VT = require('./');
var PT = require('prop-types');

var obj = {
  a: 1,
  b: '2',
  c: {
    d: new Date(),
    e: {
      f: [4, 5, 6],
      g: 'hustcc'
    }
  }
};

var VTchecker = VT.shape({
  a: VT.number,
  b: VT.string,
  c: VT.shape({
    d: VT.instanceOf(Date),
    e: VT.shape({
      f: VT.arrayOf(VT.number),
      g: VT.string
    })
  })
});


var PTchecker = PT.shape({
  a: PT.number,
  b: PT.string,
  c: PT.shape({
    d: PT.instanceOf(Date),
    e: PT.shape({
      f: PT.arrayOf(PT.number),
      g: PT.string
    })
  })
}).isRequired;

suite
  .add('variable-type', function () {
    VTchecker.check(obj);
  })
  .add('prop-types', function () {
    PT.checkPropTypes(PTchecker, obj, '', '');
  })
  .on('cycle', function (e) {
    console.log('' + e.target);
  })
  .on('complete', function() {
    var fast = this.filter('fastest');
    var slow = this.filter('slowest');
    console.log('[OPS] ' +
      fast.map('name') + ' / ' + slow.map('name') +
      ' = ' +
      (fast.map('hz') / slow.map('hz')).toFixed(3) +
      '\n'
    );
  })
  .run();
@@ -299,23 +299,55 @@
 %7D;%0A%0A
-var VTchecker =
+suite%0A  .add('variable-type', function () %7B%0A   
  VT.
@@ -350,24 +350,28 @@
  VT.shape(%7B%0A
+    
   a: VT.numb
@@ -370,24 +370,28 @@
  VT.number,%0A
+    
   b: VT.stri
@@ -390,24 +390,28 @@
  VT.string,%0A
+    
   c: VT.shap
@@ -418,16 +418,20 @@
 e(%7B%0A    
+ 
+   
 d: VT.in
@@ -442,24 +442,28 @@
 ceOf(Date),%0A
+    
     e: VT.sh
@@ -460,32 +460,36 @@
   e: VT.shape(%7B%0A
+    
       f: VT.arra
@@ -510,16 +510,20 @@
 ,%0A      
+    
 g: VT.st
@@ -519,32 +519,36 @@
    g: VT.string%0A
+    
     %7D)%0A  %7D)%0A%7D);%0A
@@ -544,33 +544,96 @@
 )%0A  
-%7D)%0A%7D);%0A%0A%0Avar
+    %7D)%0A    %7D).check(obj);%0A  %7D)%0A  .add('prop-types', function () %7B%0A   
  PT
+.
 check
-er = 
+PropTypes(
 PT.s
@@ -639,16 +639,20 @@
 shape(%7B%0A
+    
   a: PT.
@@ -659,16 +659,20 @@
 number,%0A
+    
   b: PT.
@@ -679,16 +679,20 @@
 string,%0A
+    
   c: PT.
@@ -695,24 +695,28 @@
  PT.shape(%7B%0A
+    
     d: PT.in
@@ -735,16 +735,20 @@
 e),%0A    
+ 
+   
 e: PT.sh
@@ -759,16 +759,20 @@
 %7B%0A      
+  
+  
 f: PT.ar
@@ -795,16 +795,20 @@
 ,%0A      
+    
 g: PT.st
@@ -820,173 +820,41 @@
     
-%7D)%0A  %7D)%0A%7D).isRequired;%0A%0Asuite%0A  .add('variable-type', function () %7B%0A    VTchecker.check(obj);%0A  %7D)%0A  .add('prop-types', function () %7B%0A    PT.checkPropTypes(PTchecker
+    %7D)%0A      %7D)%0A    %7D).isRequired
 , ob

update testcase