<commit_before>#!/usr/bin/env node

var inquiry = require("../..");
require("proof")(11, function (equal) {
  var object, result;
  object = { firstName: "Abraham", lastName: "Lincoln" };
  equal(inquiry("{$.firstName == 'Abraham'}")(object).pop().lastName, 'Lincoln', 'rooted');
  object = require('./presidents');
  result = inquiry("/presidents{$.firstName == 'Abraham'}")(object);
  equal(result.length, 1, 'array length');
  equal(result.pop().lastName, 'Lincoln', 'array pop');
  result = inquiry("/presidents!{$.firstName != 'Abraham'}")(object);
  equal(result.length, 1, 'negate length');
  equal(result.pop().lastName, 'Lincoln', 'negate pop');
  equal(inquiry("/presidents/.{$.firstName == 'Abraham'}")(object).pop().lastName, 'Lincoln', 'array as self');
  equal(inquiry("/presidents/.{$.firstName == 'Abraham'}/lastName")(object).pop(), 'Lincoln', 'array as self');
  equal(inquiry("/presidents{$.firstName == 'Abraham'}{$1($.lastName)}")(object, function (lastName) {
    equal(lastName, 'Lincoln', 'called');
    return true;
  }).pop().lastName, 'Lincoln', 'multiple predicates');
  equal(inquiry("/ presidents { $.firstName == 'Abraham' } { $1($.lastName) }")(object, function (lastName) {
    equal(lastName, 'Lincoln', 'called');
    return true;
  }).pop().lastName, 'Lincoln', 'multiple predicates spaced');
});
<commit_msg>Fix predicate negation tests.<commit_after>#!/usr/bin/env node

var inquiry = require("../..");
require("proof")(11, function (equal) {
  var object, result;
  object = { firstName: "Abraham", lastName: "Lincoln" };
  equal(inquiry("{$.firstName == 'Abraham'}")(object).pop().lastName, 'Lincoln', 'rooted');
  object = require('./presidents');
  result = inquiry("/presidents{$.firstName == 'Abraham'}")(object);
  equal(result.length, 1, 'array length');
  equal(result.pop().lastName, 'Lincoln', 'array pop');
  result = inquiry("/presidents!{$.firstName == 'Abraham'}")(object);
  equal(result.length, 15, 'negate length');
  equal(result.pop().lastName, 'Buchanan', 'negate pop');
  equal(inquiry("/presidents/.{$.firstName == 'Abraham'}")(object).pop().lastName, 'Lincoln', 'array as self');
  equal(inquiry("/presidents/.{$.firstName == 'Abraham'}/lastName")(object).pop(), 'Lincoln', 'array as self');
  equal(inquiry("/presidents{$.firstName == 'Abraham'}{$1($.lastName)}")(object, function (lastName) {
    equal(lastName, 'Lincoln', 'called');
    return true;
  }).pop().lastName, 'Lincoln', 'multiple predicates');
  equal(inquiry("/ presidents { $.firstName == 'Abraham' } { $1($.lastName) }")(object, function (lastName) {
    equal(lastName, 'Lincoln', 'called');
    return true;
  }).pop().lastName, 'Lincoln', 'multiple predicates spaced');
});

{'fraction_non_alphanumeric': 0.23375184638109306, 'fraction_numerical': 0.0048005908419497785, 'mean_word_length': 5.623471882640587, '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': '4899391', 'n_tokens_mistral': 911, 'n_tokens_neox': 905, 'n_words': 177}