<commit_before>'use strict';

var assert = require('assert');

var adjacency_list = require('./adjacency_list.js');
var operations = require('./operations.js');

function testBreadthFirstSearch() {
    testSearch(operations.breadthFirstSearch, [0, 1, 4, 5, 2, 3]);
}

function testDepthFirstSearch() {
    testSearch(operations.depthFirstSearch, [0, 1, 2, 3, 4, 5]);
}

function testSearch(searchFunction, expectedVertices) {
    var list = new adjacency_list.construct({
        vertexCount: 6,
        edges: [
            [0, 1],
            [0, 4],
            [0, 5],
            [1, 2],
            [1, 4],
            [2, 3],
            [3, 4]
        ]
    });

    adjacency_list.log(list);

    assert.strictEqual(list.length, 6);

    var vertices = [];
    var processVertex = function(x) {
        console.log('Processing vertex: ' + x);
        vertices.push(x);
    };

    searchFunction(list, 0, processVertex);

    assert.deepEqual(vertices, expectedVertices);
}

testBreadthFirstSearch();
testDepthFirstSearch();

console.log('All tests OK.');<commit_msg>[adjacency_list/javascript] Remove logs<commit_after>'use strict';

var assert = require('assert');

var adjacency_list = require('./adjacency_list.js');
var operations = require('./operations.js');

function testBreadthFirstSearch() {
    testSearch(operations.breadthFirstSearch, [0, 1, 4, 5, 2, 3]);
}

function testDepthFirstSearch() {
    testSearch(operations.depthFirstSearch, [0, 1, 2, 3, 4, 5]);
}

function testSearch(searchFunction, expectedVertices) {
    var list = new adjacency_list.construct({
        vertexCount: 6,
        edges: [
            [0, 1],
            [0, 4],
            [0, 5],
            [1, 2],
            [1, 4],
            [2, 3],
            [3, 4]
        ]
    });

    assert.strictEqual(list.length, 6);

    var vertices = [];
    var processVertex = function(x) {
        vertices.push(x);
    };

    searchFunction(list, 0, processVertex);

    assert.deepEqual(vertices, expectedVertices);
}

testBreadthFirstSearch();
testDepthFirstSearch();

console.log('All tests OK.');
{'fraction_non_alphanumeric': 0.14911862791805622, 'fraction_numerical': 0.027632205812291567, 'mean_word_length': 2.7168141592920354, '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': '1449702', 'n_tokens_mistral': 707, 'n_tokens_neox': 652, 'n_words': 147}