<commit_before>Connection = require('../../src/connection')
Request = require('../../src/request')
fs = require('fs')
guidParser = require('../../src/guid-parser')
TYPES = require('../../src/data-type').typeByName

getConfig = ->
  config = JSON.parse(fs.readFileSync(process.env.HOME + '/.tedious/test-connection.json', 'utf8')).config

  config.options.debug =
    packet: true
    data: true
    payload: true
    token: true
    log: true

  config

exports.bitTrue = (test) ->
  execSql(test, TYPES.Bit, true)

exports.bitFalse = (test) ->
  execSql(test, TYPES.Bit, false)

exports.bitNull = (test) ->
  execSql(test, TYPES.Bit, null)

exports.tinyInt = (test) ->
  execSql(test, TYPES.TinyInt, 8)

exports.tinyIntZero = (test) ->
  execSql(test, TYPES.TinyInt, 0)

exports.tinyIntLarge = (test) ->
  execSql(test, TYPES.TinyInt, 252)

exports.tinyIntNull = (test) ->
  execSql(test, TYPES.TinyInt, null)

exports.smallInt = (test) ->
  execSql(test, TYPES.SmallInt, 8)

exports.smallIntZero = (test) ->
  execSql(test, TYPES.SmallInt, 0)

exports.smallIntNull = (test) ->
  execSql(test, TYPES.SmallInt, null)

exports.int = (test) ->
  execSql(test, TYPES.Int, 8)

exports.bigint = (test) ->
  execSql(test, TYPES.BigInt, 9007199254740992)

exports.bigint1 = (test) ->
  execSql(test, TYPES.BigInt, 1)

exports.bigintsmall = (test) ->
  execSql(test, TYPES.BigInt, -9007199254740992)

exports.bigintsmall1 = (test) ->
  execSql(test, TYPES.BigInt, -1)

exports.real = (test) ->
  execSql(test, TYPES.Real, 9654.2529296875)

exports.float = (test) ->
  execSql(test, TYPES.Float, 9654.2546456567565767644)

exports.numeric = (test) ->
  execSql(test, TYPES.Numeric, 5555)

exports.numericLargeValue = (test) ->
  execSql(test, TYPES.Numeric, 5.555555555555553333, null, {precision: 19, scale: 18})

exports.numericNegative = (test) ->
  execSql(test, TYPES.Numeric, -5555.55, null, {precision: 6, scale: 2})

exports.decimal = (test) ->
  execSql(test, TYPES.Decimal, 5555)

exports.decimalLargeValue = (test) ->
  execSql(test, TYPES.Decimal, 5.555555555555553333, null, {precision: 19, scale: 18})

exports.decimalNegative = (test) ->
  execSql(test, TYPES.Decimal, -5555.55, null, {precision: 6, scale: 2})

exports.smallMoney = (test) ->
  execSql(test, TYPES.SmallMoney, 9842.4566)

exports.money = (test) ->
  execSql(test, TYPES.Money, 956455842.4566)

exports.uniqueIdentifierN = (test) ->
  execSql(test, TYPES.UniqueIdentifierN, '01234567-89AB-CDEF-0123-456789ABCDEF')

exports.intZero = (test) ->
  execSql(test, TYPES.Int, 0)

exports.intNull = (test) ->
  execSql(test, TYPES.Int, null)

exports.varChar = (test) ->
  execSql(test, TYPES.VarChar, 'qaz')

exports.varCharN = (test) ->
  execSql(test, TYPES.VarChar, 'qaz', null, {length: 8001})

exports.varCharEmptyString = (test) ->
  execSql(test, TYPES.VarChar, '')

exports.varCharNull = (test) ->
  execSql(test, TYPES.VarChar, null)

exports.varCharMax = (test) ->
  longString = ''
  for i in [1..(10 * 1000)]
    longString += 'x'

  execSql(test, TYPES.VarChar, longString, '7_2')

exports.nVarChar = (test) ->
  execSql(test, TYPES.NVarChar, 'qaz')

exports.nVarCharN = (test) ->
  execSql(test, TYPES.NVarChar, 'qaz', null, {length: 4001})

exports.nVarCharEmptyString = (test) ->
  execSql(test, TYPES.NVarChar, '')

exports.nVarCharNull = (test) ->
  execSql(test, TYPES.NVarChar, null)

exports.nVarCharMax = (test) ->
  longString = ''
  for i in [1..(10 * 1000)]
    longString += 'x'

  execSql(test, TYPES.NVarChar, longString, '7_2')

exports.Char = (test) ->
  execSql(test, TYPES.Char, 'qaz')

exports.CharN = (test) ->
  execSql(test, TYPES.Char, 'qaz', null, {length: 3})

exports.CharNull = (test) ->
  execSql(test, TYPES.Char, null)

exports.NChar = (test) ->
  execSql(test, TYPES.NChar, 'qaz')

exports.NCharN = (test) ->
  execSql(test, TYPES.NChar, 'qaz', null, {length: 3})

exports.NCharNull = (test) ->
  execSql(test, TYPES.NChar, null)

exports.textNull = (test) ->
  execSql(test, TYPES.Text, null)

exports.textEmpty = (test) ->
  execSql(test, TYPES.Text, '')

exports.textSmall = (test) ->
  execSql(test, TYPES.Text, 'small')

exports.textLarge = (test) ->
  dBuf = new Buffer(5000000)
  dBuf.fill('x')
  execSql(test, TYPES.Text, dBuf.toString())

exports.smallDateTime = (test) ->
  execSql(test, TYPES.SmallDateTime, new Date('December 4, 2011 10:04:00'))

exports.smallDateTimeNull = (test) ->
  execSql(test, TYPES.SmallDateTime, null)

exports.dateTime = (test) ->
  execSql(test, TYPES.DateTime, new Date('December 4, 2011 10:04:23'))

exports.dateTimeNull = (test) ->
  execSql(test, TYPES.DateTime, null)

exports.outputBitTrue = (test) ->
  execSqlOutput(test, TYPES.Bit, true)

exports.outputBitFalse = (test) ->
  execSqlOutput(test, TYPES.Bit, false)

exports.outputBitNull = (test) -><commit_msg>Reduce the large text size from 5 to 0.5 MB.<commit_after>Connection = require('../../src/connection')
Request = require('../../src/request')
fs = require('fs')
guidParser = require('../../src/guid-parser')
TYPES = require('../../src/data-type').typeByName

getConfig = ->
  config = JSON.parse(fs.readFileSync(process.env.HOME + '/.tedious/test-connection.json', 'utf8')).config

  config.options.debug =
    packet: true
    data: true
    payload: true
    token: true
    log: true

  config

exports.bitTrue = (test) ->
  execSql(test, TYPES.Bit, true)

exports.bitFalse = (test) ->
  execSql(test, TYPES.Bit, false)

exports.bitNull = (test) ->
  execSql(test, TYPES.Bit, null)

exports.tinyInt = (test) ->
  execSql(test, TYPES.TinyInt, 8)

exports.tinyIntZero = (test) ->
  execSql(test, TYPES.TinyInt, 0)

exports.tinyIntLarge = (test) ->
  execSql(test, TYPES.TinyInt, 252)

exports.tinyIntNull = (test) ->
  execSql(test, TYPES.TinyInt, null)

exports.smallInt = (test) ->
  execSql(test, TYPES.SmallInt, 8)

exports.smallIntZero = (test) ->
  execSql(test, TYPES.SmallInt, 0)

exports.smallIntNull = (test) ->
  execSql(test, TYPES.SmallInt, null)

exports.int = (test) ->
  execSql(test, TYPES.Int, 8)

exports.bigint = (test) ->
  execSql(test, TYPES.BigInt, 9007199254740992)

exports.bigint1 = (test) ->
  execSql(test, TYPES.BigInt, 1)

exports.bigintsmall = (test) ->
  execSql(test, TYPES.BigInt, -9007199254740992)

exports.bigintsmall1 = (test) ->
  execSql(test, TYPES.BigInt, -1)

exports.real = (test) ->
  execSql(test, TYPES.Real, 9654.2529296875)

exports.float = (test) ->
  execSql(test, TYPES.Float, 9654.2546456567565767644)

exports.numeric = (test) ->
  execSql(test, TYPES.Numeric, 5555)

exports.numericLargeValue = (test) ->
  execSql(test, TYPES.Numeric, 5.555555555555553333, null, {precision: 19, scale: 18})

exports.numericNegative = (test) ->
  execSql(test, TYPES.Numeric, -5555.55, null, {precision: 6, scale: 2})

exports.decimal = (test) ->
  execSql(test, TYPES.Decimal, 5555)

exports.decimalLargeValue = (test) ->
  execSql(test, TYPES.Decimal, 5.555555555555553333, null, {precision: 19, scale: 18})

exports.decimalNegative = (test) ->
  execSql(test, TYPES.Decimal, -5555.55, null, {precision: 6, scale: 2})

exports.smallMoney = (test) ->
  execSql(test, TYPES.SmallMoney, 9842.4566)

exports.money = (test) ->
  execSql(test, TYPES.Money, 956455842.4566)

exports.uniqueIdentifierN = (test) ->
  execSql(test, TYPES.UniqueIdentifierN, '01234567-89AB-CDEF-0123-456789ABCDEF')

exports.intZero = (test) ->
  execSql(test, TYPES.Int, 0)

exports.intNull = (test) ->
  execSql(test, TYPES.Int, null)

exports.varChar = (test) ->
  execSql(test, TYPES.VarChar, 'qaz')

exports.varCharN = (test) ->
  execSql(test, TYPES.VarChar, 'qaz', null, {length: 8001})

exports.varCharEmptyString = (test) ->
  execSql(test, TYPES.VarChar, '')

exports.varCharNull = (test) ->
  execSql(test, TYPES.VarChar, null)

exports.varCharMax = (test) ->
  longString = ''
  for i in [1..(10 * 1000)]
    longString += 'x'

  execSql(test, TYPES.VarChar, longString, '7_2')

exports.nVarChar = (test) ->
  execSql(test, TYPES.NVarChar, 'qaz')

exports.nVarCharN = (test) ->
  execSql(test, TYPES.NVarChar, 'qaz', null, {length: 4001})

exports.nVarCharEmptyString = (test) ->
  execSql(test, TYPES.NVarChar, '')

exports.nVarCharNull = (test) ->
  execSql(test, TYPES.NVarChar, null)

exports.nVarCharMax = (test) ->
  longString = ''
  for i in [1..(10 * 1000)]
    longString += 'x'

  execSql(test, TYPES.NVarChar, longString, '7_2')

exports.Char = (test) ->
  execSql(test, TYPES.Char, 'qaz')

exports.CharN = (test) ->
  execSql(test, TYPES.Char, 'qaz', null, {length: 3})

exports.CharNull = (test) ->
  execSql(test, TYPES.Char, null)

exports.NChar = (test) ->
  execSql(test, TYPES.NChar, 'qaz')

exports.NCharN = (test) ->
  execSql(test, TYPES.NChar, 'qaz', null, {length: 3})

exports.NCharNull = (test) ->
  execSql(test, TYPES.NChar, null)

exports.textNull = (test) ->
  execSql(test, TYPES.Text, null)

exports.textEmpty = (test) ->
  execSql(test, TYPES.Text, '')

exports.textSmall = (test) ->
  execSql(test, TYPES.Text, 'small')

exports.textLarge = (test) ->
  dBuf = new Buffer(500000)
  dBuf.fill('x')
  execSql(test, TYPES.Text, dBuf.toString())

exports.smallDateTime = (test) ->
  execSql(test, TYPES.SmallDateTime, new Date('December 4, 2011 10:04:00'))

exports.smallDateTimeNull = (test) ->
  execSql(test, TYPES.SmallDateTime, null)

exports.dateTime = (test) ->
  execSql(test, TYPES.DateTime, new Date('December 4, 2011 10:04:23'))

exports.dateTimeNull = (test) ->
  execSql(test, TYPES.DateTime, null)

exports.outputBitTrue = (test) ->
  execSqlOutput(test, TYPES.Bit, true)

exports.outputBitFalse = (test) ->
  execSqlOutput(test, TYPES.Bit, false)

exports.outputBitNull = (test) ->
{'fraction_non_alphanumeric': 0.17394002068252326, 'fraction_numerical': 0.052119958634953466, 'mean_word_length': 4.149627263045794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '3310320', 'n_tokens_mistral': 4092, 'n_tokens_neox': 3824, 'n_words': 725}