<commit_before>require('chai').should();

var rlp = require('../src/rlp');
var util = require('../src/util');

describe('rlp', function(){
  describe('#decode', function(){
    it('should decode cat', function(){
      var data = '\x83cat';
      var exp = 'cat';
      var res = rlp.decode(data);
      res.should.equal(exp);
    })
})
<commit_msg>rlp encode tests; todo: integers<commit_after>require('chai').should();

var rlp = require('../src/rlp');
var util = require('../src/util');

describe('rlp', function(){
  describe('#encode', function(){
    it('should encode dog', function(){
      var data = 'dog';
      var exp = '\x83dog';
      var res = rlp.encode(data);
      res.should.equal(exp);
    })

    it('should encode [cat, dog]', function(){
      var data = ['cat', 'dog'];
      var exp = '\xc8\x83cat\x83dog';
      var res = rlp.encode(data);
      res.should.equal(exp);
    })

    it('should encode empty string', function(){
      var data = '';
      var exp = '\x80';
      var res = rlp.encode(data);
      res.should.equal(exp);
    })

    it('should encode empty []', function(){
      var data = [];
      var exp = '\xc0';
      var res = rlp.encode(data);
      res.should.equal(exp);
    })

    it.skip('should encode integer 15', function(){
      var data = 15;
      var exp = '\x0f';
      var res = rlp.encode(data);
      res.should.equal(exp);
    })

    it('should encode set theoretical representation of two', function(){
      var data = [ [], [[]], [ [], [[]] ] ];
      var exp = '\xc7\xc0\xc1\xc0\xc3\xc0\xc1\xc0';
      var res = rlp.encode(data);
      res.should.equal(exp);
    })

    it('should encode string', function(){
      var data = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit';
      var exp = '\xb88Lorem ipsum dolor sit amet, consectetur adipisicing elit';
      var res = rlp.encode(data);
      res.should.equal(exp);
    })
  })

  describe('#decode', function(){
    it('should decode cat', function(){
      var data = '\x83cat';
      var exp = 'cat';
      var res = rlp.decode(data);
      res.should.equal(exp);
    })
  })
})

{'fraction_non_alphanumeric': 0.18820754716981133, 'fraction_numerical': 0.013679245283018868, 'mean_word_length': 2.5232558139534884, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2080857', 'n_tokens_mistral': 723, 'n_tokens_neox': 699, 'n_words': 173}