<commit_before>var expect = require('chai').expect;
var binarySearch = require('./binary-search');

describe("binary-search", function () {
    it("should return -1 given an empty array", function () {
        expect(binarySearch([], 0)).to.equal(-1);
    });
    it("should return 0 if the array length is 1 and the search key matches", function () {
        expect(binarySearch([1], 1)).to.equal(0);
    });
    it("should return -1 if the array length is 1 and the search key doesn't match", function () {
        expect(binarySearch([2], 1)).to.equal(-1);
    });
    it("should return 0 when looking for 10 in the array [10, 20, 30, 40]", function () {
        expect(binarySearch([10, 20, 30, 40], 10)).to.equal(0);
    });
    it("should return 2 when looking for 30 in the array [10, 20, 30, 40]", function () {
        expect(binarySearch([10, 20, 30, 40], 30)).to.equal(2);
    });
    it("should return 2 when looking for 30 in the array [10, 20, 30, 40, 50]", function () {
        expect(binarySearch([10, 20, 30, 40, 50], 30)).to.equal(2);
    });
    it("should return -1 when looking for 55 in the array [10, 20, 30, 40, 50]", function () {
        expect(binarySearch([10, 20, 30, 40, 50], 30)).to.equal(-1);
    });<commit_msg>Detected a new error when trying to find a number that does not exist in the array. The number returned is not -1, since there is an addition with the number in the middle every time we call the recursion<commit_after>var expect = require('chai').expect;
var binarySearch = require('./binary-search');

describe("binary-search", function () {
    it("should return -1 given an empty array", function () {
        expect(binarySearch([], 0)).to.equal(-1);
    });
    it("should return 0 if the array length is 1 and the search key matches", function () {
        expect(binarySearch([1], 1)).to.equal(0);
    });
    it("should return -1 if the array length is 1 and the search key doesn't match", function () {
        expect(binarySearch([2], 1)).to.equal(-1);
    });
    it("should return 0 when looking for 10 in the array [10, 20, 30, 40]", function () {
        expect(binarySearch([10, 20, 30, 40], 10)).to.equal(0);
    });
    it("should return 2 when looking for 30 in the array [10, 20, 30, 40]", function () {
        expect(binarySearch([10, 20, 30, 40], 30)).to.equal(2);
    });
    it("should return 2 when looking for 30 in the array [10, 20, 30, 40, 50]", function () {
        expect(binarySearch([10, 20, 30, 40, 50], 30)).to.equal(2);
    });
    it("should return -1 when looking for 55 in the array [10, 20, 30, 40, 50]", function () {
        expect(binarySearch([10, 20, 30, 40, 50], 55)).to.equal(-1);
    });
{'fraction_non_alphanumeric': 0.16822081312942933, 'fraction_numerical': 0.08168593808280493, 'mean_word_length': 3.190625, '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': '6427593', 'n_tokens_mistral': 986, 'n_tokens_neox': 801, 'n_words': 313}