<commit_before>/* global describe, it */
var statement = require('../lib/statement')
var assert = require('assert')

describe('Statement', function () {
  describe('#checkWellFormed', function () {
    it('(P -> Q => unbalanced parentheses', function () {
      var error = statement.checkWellFormed('(P -> Q')
      assert.equal(error, 'unbalanced parentheses!')
    })

    it('P -> & => missing operand', function () {
      var error = statement.checkWellFormed('P -> &')
      assert.equal(error, 'missing operand!')
    })

    it('&& => double operators', function () {
      var error = statement.checkWellFormed('&&')
      assert.equal(error, 'double operators!')
    })

    it('A || (~ & B) => missing operand', function () {
      var error = statement.checkWellFormed('A || (~ & B)')
      assert.equal(error, 'missing operand!')
    })

    it('(A || (~ & B) => unbalanced parentheses', function () {
      var error = statement.checkWellFormed('(A || (~ & B)')
      assert.equal(error, 'unbalanced parentheses!')
    })
  })

  describe('#evaluate', function () {
    it('(P <-> Q) <-> ((P || R) -> (~Q -> R))', function () {
      var out = false
      var str = '(P <-> Q) <-> ((P || R) -> (~Q -> R))'

      out = statement.evaluate(str, {'P': true, 'Q': true, 'R': true})
      assert.equal(out, true)

      out = statement.evaluate(str, {'P': true, 'Q': true, 'R': false})
      assert.equal(out, true)

      out = statement.evaluate(str, {'P': true, 'Q': false, 'R': true})
      assert.equal(out, false)

      out = statement.evaluate(str, {'P': true, 'Q': false, 'R': false})
      assert.equal(out, true)
<commit_msg>fix: update error message for failing test<commit_after>/* global describe, it */
var statement = require('../lib/statement')
var assert = require('assert')

describe('Statement', function () {
  describe('#checkWellFormed', function () {
    it('(P -> Q => unbalanced parentheses', function () {
      var error = statement.checkWellFormed('(P -> Q')
      assert.equal(error, 'unbalanced parentheses!')
    })

    it('P -> & => missing operand', function () {
      var error = statement.checkWellFormed('P -> &')
      assert.equal(error, 'missing operand!')
    })

    it('&& => double operators', function () {
      var error = statement.checkWellFormed('&&')
      assert.equal(error, 'double operators!')
    })

    it('A | (~A & B) => unknown symbol!', function () {
      var error = statement.checkWellFormed('A | (~A & B)')
      assert.equal(error, 'unknown symbol!')
    })

    it('(A || (~ & B) => unbalanced parentheses', function () {
      var error = statement.checkWellFormed('(A || (~ & B)')
      assert.equal(error, 'unbalanced parentheses!')
    })
  })

  describe('#evaluate', function () {
    it('(P <-> Q) <-> ((P || R) -> (~Q -> R))', function () {
      var out = false
      var str = '(P <-> Q) <-> ((P || R) -> (~Q -> R))'

      out = statement.evaluate(str, {'P': true, 'Q': true, 'R': true})
      assert.equal(out, true)

      out = statement.evaluate(str, {'P': true, 'Q': true, 'R': false})
      assert.equal(out, true)

      out = statement.evaluate(str, {'P': true, 'Q': false, 'R': true})
      assert.equal(out, false)

      out = statement.evaluate(str, {'P': true, 'Q': false, 'R': false})
      assert.equal(out, true)

{'fraction_non_alphanumeric': 0.21084337349397592, 'fraction_numerical': 0.0, 'mean_word_length': 2.948870392390012, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, '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': '2228695', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1052, 'n_words': 268}