<commit_before>var Sequelize      = require("../../index")
  , sequelize      = new Sequelize(null, null, null, { dialect: 'sqlite' })
  , Helpers        = new (require("../config/helpers"))(sequelize)
  , QueryGenerator = require("../../lib/dialects/sqlite/query-generator")
  , util           = require("util");

describe('QueryGenerator', function() {
  beforeEach(function() { Helpers.sync() })
  afterEach(function() { Helpers.drop() })

  var suites = {
    insertQuery: [
      {
        arguments: ['myTable', { name: 'foo' }],
        expectation: "INSERT INTO `myTable` (`name`) VALUES ('foo');"
      }, {
        arguments: ['myTable', { name: "'bar'" }],
        expectation: "INSERT INTO `myTable` (`name`) VALUES ('''bar''');"
      }, {
        arguments: ['myTable', { name: "bar", value: null }],
        expectation: "INSERT INTO `myTable` (`name`,`value`) VALUES ('bar',NULL);"
      }, {
        arguments: ['myTable', { name: "bar", value: undefined }],
        expectation: "INSERT INTO `myTable` (`name`,`value`) VALUES ('bar',NULL);"
      }
    ],

    updateQuery: [
      {
        arguments: ['myTable', { name: 'foo' }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='foo' WHERE `id`=2"
      }, {
        arguments: ['myTable', { name: "'bar'" }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='''bar''' WHERE `id`=2"
      }, {
        arguments: ['myTable', { name: 'bar', value: null }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='bar',`value`=NULL WHERE `id`=2"
      }, {
        arguments: ['myTable', { name: 'bar', value: undefined }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='bar',`value`=NULL WHERE `id`=2"
      }
    ]
  };

  Sequelize.Utils._.each(suites, function(tests, suiteTitle) {
    describe(suiteTitle, function() {
      tests.forEach(function(test) {
        var title = test.title || 'correctly returns ' + test.expectation + ' for ' + util.inspect(test.arguments)<commit_msg>sqlite: test cases for boolean values<commit_after>var Sequelize      = require("../../index")
  , sequelize      = new Sequelize(null, null, null, { dialect: 'sqlite' })
  , Helpers        = new (require("../config/helpers"))(sequelize)
  , QueryGenerator = require("../../lib/dialects/sqlite/query-generator")
  , util           = require("util");

describe('QueryGenerator', function() {
  beforeEach(function() { Helpers.sync() })
  afterEach(function() { Helpers.drop() })

  var suites = {
    insertQuery: [
      {
        arguments: ['myTable', { name: 'foo' }],
        expectation: "INSERT INTO `myTable` (`name`) VALUES ('foo');"
      }, {
        arguments: ['myTable', { name: "'bar'" }],
        expectation: "INSERT INTO `myTable` (`name`) VALUES ('''bar''');"
      }, {
        arguments: ['myTable', { name: "bar", value: null }],
        expectation: "INSERT INTO `myTable` (`name`,`value`) VALUES ('bar',NULL);"
      }, {
        arguments: ['myTable', { name: "bar", value: undefined }],
        expectation: "INSERT INTO `myTable` (`name`,`value`) VALUES ('bar',NULL);"
      }, {
        arguments: ['myTable', { name: "foo", value: true }],
        expectation: "INSERT INTO `myTable` (`name`,`value`) VALUES ('foo',1);"
      }, {
        arguments: ['myTable', { name: "foo", value: false }],
        expectation: "INSERT INTO `myTable` (`name`,`value`) VALUES ('foo',0);"
      }
    ],

    updateQuery: [
      {
        arguments: ['myTable', { name: 'foo' }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='foo' WHERE `id`=2"
      }, {
        arguments: ['myTable', { name: "'bar'" }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='''bar''' WHERE `id`=2"
      }, {
        arguments: ['myTable', { name: 'bar', value: null }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='bar',`value`=NULL WHERE `id`=2"
      }, {
        arguments: ['myTable', { name: 'bar', value: undefined }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `name`='bar',`value`=NULL WHERE `id`=2"
      }, {
        arguments: ['myTable', { flag: true }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `flag`=1 WHERE `id`=2"
      }, {
        arguments: ['myTable', { flag: false }, { id: 2 }],
        expectation: "UPDATE `myTable` SET `flag`=0 WHERE `id`=2"
      }
    ]
  };

  Sequelize.Utils._.each(suites, function(tests, suiteTitle) {
    describe(suiteTitle, function() {
      tests.forEach(function(test) {
        var title = test.title || 'correctly returns ' + test.expectation + ' for ' + util.inspect(test.arguments)
{'fraction_non_alphanumeric': 0.20638020833333334, 'fraction_numerical': 0.005208333333333333, 'mean_word_length': 2.8280730897009967, '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': '3737926', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1468, 'n_words': 346}