<commit_before>var assert = require('assert')
var scripts = require('../src/scripts')

var ECPubKey = require('../src/ecpubkey')
var Script = require('../src/script')

var fixtures = require('./fixtures/scripts.json')

describe('Scripts', function() {
  describe('classifyInput', function() {
    fixtures.valid.forEach(function(f) {
      if (!f.scriptSig) return

      it('classifies ' + f.scriptSig + ' as ' + f.type, function() {
        var script = Script.fromASM(f.scriptSig)
        var type = scripts.classifyInput(script)

        assert.equal(type, f.type)
      })
    })
  })

  describe('classifyOutput', function() {
    fixtures.valid.forEach(function(f) {
      if (!f.scriptPubKey) return

      it('classifies ' + f.scriptPubKey + ' as ' + f.type, function() {
        var script = Script.fromASM(f.scriptPubKey)
        var type = scripts.classifyOutput(script)

        assert.equal(type, f.type)
      })<commit_msg>scripts: add TODO for tests for isCanonical* functions<commit_after>var assert = require('assert')
var scripts = require('../src/scripts')

var ECPubKey = require('../src/ecpubkey')
var Script = require('../src/script')

var fixtures = require('./fixtures/scripts.json')

describe('Scripts', function() {
  // TODO
  describe.skip('isCanonicalPubKey', function() {})
  describe.skip('isCanonicalSignature', function() {})

  describe('classifyInput', function() {
    fixtures.valid.forEach(function(f) {
      if (!f.scriptSig) return

      it('classifies ' + f.scriptSig + ' as ' + f.type, function() {
        var script = Script.fromASM(f.scriptSig)
        var type = scripts.classifyInput(script)

        assert.equal(type, f.type)
      })
    })
  })

  describe('classifyOutput', function() {
    fixtures.valid.forEach(function(f) {
      if (!f.scriptPubKey) return

      it('classifies ' + f.scriptPubKey + ' as ' + f.type, function() {
        var script = Script.fromASM(f.scriptPubKey)
        var type = scripts.classifyOutput(script)

        assert.equal(type, f.type)
      })
{'fraction_non_alphanumeric': 0.15807560137457044, 'fraction_numerical': 0.0, 'mean_word_length': 3.15071283095723, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '714948', 'n_tokens_mistral': 646, 'n_tokens_neox': 628, 'n_words': 122}