text: /**
   * @fileoverview Tests for camelcase rule
   * @author Raghav Dua <duaraghav8@gmail.com>
   */
  
  'use strict';
  
  var Solium = require ('../../../../lib/solium');
  var wrappers = require ('../../../utils/wrappers');
  var toContract = wrappers.toContract;
  var addPragma = wrappers.addPragma;
  
  var userConfig = {
    "custom-rules-filename": null,
    "rules": {
      "camelcase": true
    }
  };
  
  describe ('[RULE] camelcase: Acceptances', function () {
  
  	it ('accepts valid contract names', function (done) {
  		var code = [
  			'contract Hello {}',
  			'contract HelloWorld {}',
  			'contract He {}',
  			'contract HELlOWoRlD {}',
  			'contract HeLLOWORLd {}',
  			'contract MyToken2 {}',
  			'contract My29Token10 {}',
  			'contract M123 {}'
  		];
  		var errors;
  
  		code = code.map(function(item){return addPragma(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [5], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [6], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [7], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		Solium.reset ();
  		done ();
  	});
  
  	it ('accepts valid library names', function (done) {
  		var code = [
  			'library Hello {}',
  			'library HelloWorld {}',
  			'library He {}',
  			'library HELlOWoRlD {}',
  			'library HeLLOWORLd {}',
  			'library MyToken2 {}',
  			'library My29Token10 {}',
  			'library M123 {}'
  		];
  		var errors;
  
  		code = code.map(function(item){return addPragma(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [5], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [6], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [7], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		Solium.reset ();
  		done ();
  	});
  
  	it ('accepts valid event names', function (done) {
  		var code = [
  			'event Hello();',
  			'event HelloWorld();',
  			'event He();',
  			'event HELlOWoRlD();',
  			'event HeLLOWORLd();',
  			'event MyToken2();',
  			'event My29Token10();',
  			'event M123();'
  		];
  		var errors;
  
  		code = code.map(function(item){return toContract(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [5], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [6], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [7], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		Solium.reset ();
  		done ();
  	});
  
  	it ('accepts valid struct names', function (done) {
  		var code = [
  			'struct Hello {}',
  			'struct HelloWorld {}',
  			'struct He {}',
  			'struct HELlOWoRlD {}',
  			'struct HeLLOWORLd {}',
  			'struct MyToken2 {}',
  			'struct My29Token10 {}',
  			'struct M123 {}'
  		];
  		var errors;
  
  		code = code.map(function(item){return toContract(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [5], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [6], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		errors = Solium.lint (code [7], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (0);
  
  		Solium.reset ();
  		done ();
  	});
  
  });
  
  
  describe ('[RULE] camelcase: Rejections', function () {
  
  	it ('rejects invalid contract names', function (done) {
  		var code = [
  			'contract hello {}',
  			'contract H {}',
  			'contract h {}',
  			'contract Hello_World {}',
  			'contract hello_1world {}'
  		];
  		var errors;
  
  		code = code.map(function(item){return addPragma(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		Solium.reset ();
  		done ();
  	});
  
  	it ('rejects invalid library names', function (done) {
  		var code = [
  			'library hello {}',
  			'library H {}',
  			'library h {}',
  			'library Hello_World {}',
  			'library hello_1world {}'
  		];
  		var errors;
  
  		code = code.map(function(item){return addPragma(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		Solium.reset ();
  		done ();
  	});
  
  	it ('rejects invalid event names', function (done) {
  		var code = [
  			'event hello();',
  			'event H();',
  			'event h();',
  			'event Hello_World();',
  			'event hello_1world();'
  		];
  		var errors;
  
  		code = code.map(function(item){return toContract(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		Solium.reset ();
  		done ();
  	});
  
  	it ('rejects invalid struct names', function (done) {
  		var code = [
  			'struct hello {}',
  			'struct H {}',
  			'struct h {}',
  			'struct Hello_World {}',
  			'struct hello_1world {}'
  		];
  		var errors;
  
  		code = code.map(function(item){return toContract(item)});
  
  		errors = Solium.lint (code [0], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [1], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [2], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [3], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		errors = Solium.lint (code [4], userConfig);
  		errors.constructor.name.should.equal ('Array');
  		errors.length.should.equal (1);
  
  		Solium.reset ();
  		done ();
  	});
  
  });
  