<commit_before>'use strict'
var Buffer = require('../../').Buffer
const assert = require('assert')

const buf = Buffer.allocUnsafe(8)

;['LE', 'BE'].forEach(function(endianness) {
  // Should allow simple BigInts to be written and read
  let val = 123456789n
  buf['writeBigInt64' + endianness](val, 0)
  let rtn = buf['readBigInt64' + endianness](0)
  assert.strictEqual(val, rtn)

  // Should allow INT64_MAX to be written and read
  val = 0x7fffffffffffffffn
  buf['writeBigInt64' + endianness](val, 0)
  rtn = buf['readBigInt64' + endianness](0)
  assert.strictEqual(val, rtn)

  // Should read and write a negative signed 64-bit integer
  val = -123456789n
  buf['writeBigInt64' + endianness](val, 0)
  assert.strictEqual(val, buf['readBigInt64' + endianness](0))

  // Should read and write an unsigned 64-bit integer
  val = 123456789n
  buf['writeBigUInt64' + endianness](val, 0)
  assert.strictEqual(val, buf['readBigUInt64' + endianness](0))

  // Should throw a RangeError upon INT64_MAX+1 being written
  assert.throws(function() {
    const val = 0x8000000000000000n
    buf['writeBigInt64' + endianness](val, 0)
  }, RangeError)

  // Should throw a RangeError upon UINT64_MAX+1 being written
  assert.throws(function() {
    const val = 0x10000000000000000n
    buf['writeBigUInt64' + endianness](val, 0)
  }, {
    code: 'ERR_OUT_OF_RANGE',
    message: 'The value of "value" is out of range. It must be ' +
             '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n'
  })

  // Should throw a TypeError upon invalid input
  assert.throws(function() {
    buf['writeBigInt64' + endianness]('bad', 0)
  }, TypeError)
<commit_msg>:white_check_mark: Update assertion method to capture error<commit_after>'use strict'
var Buffer = require('../../').Buffer
const assert = require('assert')

const buf = Buffer.allocUnsafe(8)

;['LE', 'BE'].forEach(function(endianness) {
  // Should allow simple BigInts to be written and read
  let val = 123456789n
  buf['writeBigInt64' + endianness](val, 0)
  let rtn = buf['readBigInt64' + endianness](0)
  assert.strictEqual(val, rtn)

  // Should allow INT64_MAX to be written and read
  val = 0x7fffffffffffffffn
  buf['writeBigInt64' + endianness](val, 0)
  rtn = buf['readBigInt64' + endianness](0)
  assert.strictEqual(val, rtn)

  // Should read and write a negative signed 64-bit integer
  val = -123456789n
  buf['writeBigInt64' + endianness](val, 0)
  assert.strictEqual(val, buf['readBigInt64' + endianness](0))

  // Should read and write an unsigned 64-bit integer
  val = 123456789n
  buf['writeBigUInt64' + endianness](val, 0)
  assert.strictEqual(val, buf['readBigUInt64' + endianness](0))

  // Should throw a RangeError upon INT64_MAX+1 being written
  assert.throws(function() {
    const val = 0x8000000000000000n
    buf['writeBigInt64' + endianness](val, 0)
  }, RangeError)

  // Should throw a RangeError upon UINT64_MAX+1 being written
  assert.throws(function() {
    const val = 0x10000000000000000n
    buf['writeBigUInt64' + endianness](val, 0)
  }, function(err) {
    assert(err instanceof RangeError)
    assert(err.code === 'ERR_OUT_OF_RANGE')
    assert(err.message === 'The value of "value" is out of range. It must be ' +
             '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n')
    return true;
  })

  // Should throw a TypeError upon invalid input
  assert.throws(function() {
    buf['writeBigInt64' + endianness]('bad', 0)
  }, TypeError)

{'fraction_non_alphanumeric': 0.12767186597342575, 'fraction_numerical': 0.07741190063547082, 'mean_word_length': 4.04075691411936, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, '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': '6626019', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1165, 'n_words': 308}