<commit_before>/*
 Copyright 2016 - 2016 by <NAME>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

(function() {
  "use strict";

  var expect = require("chai").expect;
  var util = require("../../src/_private/util");
  var testUtil = require("../_testUtil");
  var Contract = require("../../src/I/Contract");
  var ConditionMetaError = require("../../src/I/ConditionMetaError");
  var ConditionViolation = require("../../src/I/ConditionViolation");

  // describe("I", function() {
    describe("I/Contract", function() {

      function invariants(contract) {
        testUtil.expectFrozenReadOnlyArrayPropertyWithPrivateBackingField(contract, "pre", "_pre");
        testUtil.expectFrozenReadOnlyArrayPropertyWithPrivateBackingField(contract, "post", "_post");
        testUtil.expectFrozenReadOnlyArrayPropertyWithPrivateBackingField(contract, "exception", "_exception");
        expect(contract).to.have.property("verifyOne").that.is.a("function");
        expect(contract).to.have.property("verifyAll").that.is.a("function");
        expect(contract).to.have.property("implementation").that.is.a("function");
      }

      var someConditions = [
        function() {return [];},
        function() {return ["shallow"];}
      ];
      var preCases = [
        function() {return null;}
      ].concat(someConditions);
      var postCases = [
        function() {return null;}
      ].concat(someConditions);
      var exceptionCases = [
        function() {return null;}
      ].concat(someConditions);

      var subjects = testUtil.x(preCases, postCases, exceptionCases).map(function(args) {
        return function() {return new Contract(args[0](), args[1](), args[2]());};
      });

      var selfCases = [
        function() {return undefined;},
        function() {return null;},
        function() {return {};}
      ];

      function args() {return arguments;}

      var argsCases = [
        function() {return args();},
        function() {return args("an argument");},
        function() {return args("an argument", "another argument");},
        function() {return ["an argument in an array"];}
      ];

      var thingsThatAreNotAFunctionNorAContract = [
        undefined,
        null,
        "",
        "foo",
        0,
        -1,
        true,
        false,
        /lala/,
        {},
        new Date()<commit_msg>More cases<commit_after>/*
 Copyright 2016 - 2016 by <NAME>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

(function() {
  "use strict";

  var expect = require("chai").expect;
  var util = require("../../src/_private/util");
  var testUtil = require("../_testUtil");
  var Contract = require("../../src/I/Contract");
  var ConditionMetaError = require("../../src/I/ConditionMetaError");
  var ConditionViolation = require("../../src/I/ConditionViolation");

  // describe("I", function() {
    describe("I/Contract", function() {

      function invariants(contract) {
        testUtil.expectFrozenReadOnlyArrayPropertyWithPrivateBackingField(contract, "pre", "_pre");
        testUtil.expectFrozenReadOnlyArrayPropertyWithPrivateBackingField(contract, "post", "_post");
        testUtil.expectFrozenReadOnlyArrayPropertyWithPrivateBackingField(contract, "exception", "_exception");
        expect(contract).to.have.property("verifyOne").that.is.a("function");
        expect(contract).to.have.property("verifyAll").that.is.a("function");
        expect(contract).to.have.property("implementation").that.is.a("function");
      }

      var someConditions = [
        function() {return [];},
        function() {return ["shallow"];}
      ];
      var preCases = [
        function() {return null;}
      ].concat(someConditions);
      var postCases = [
        function() {return null;}
      ].concat(someConditions);
      var exceptionCases = [
        function() {return null;}
      ].concat(someConditions);

      var subjects = testUtil.x(preCases, postCases, exceptionCases).map(function(args) {
        return function() {return new Contract(args[0](), args[1](), args[2]());};
      });

      var selfCases = [
        function() {return undefined;},
        function() {return null;},
        function() {return {};}
      ];

      function args() {return arguments;}

      var argsCases = [
        function() {return args();},
        function() {return args("an argument");},
        function() {return args("an argument", "another argument");},
        function() {return ["an argument in an array"];}
      ];

      var thingsThatAreNotAFunctionNorAContract = [
        undefined,
        null,
        "",
        "foo",
        0,
        -1,
        true,
        false,
        /lala/,
        {},
        new Date(),
        new Number(42),
        new Boolean(true),
        new String("lalala")
{'fraction_non_alphanumeric': 0.14208695652173914, 'fraction_numerical': 0.006260869565217392, 'mean_word_length': 2.906929347826087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2313198', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1530, 'n_words': 422}