<commit_before>import {expect, assert} from "chai";
import {V1CommandLineToolModel} from "./V1CommandLineToolModel";
import { CommandLineTool } from "../../mappings/v1.0/CommandLineTool";
import { CommandLinePart } from "../helpers/CommandLinePart";

function runTest(app: CommandLineTool, job: any, expected: CommandLinePart[], done) {
    let model = new V1CommandLineToolModel(app);
    model.setJob(job);
    model.generateCommandLineParts().then((result) => {
        let resStr = result.map(
            (part) => {return part.value}
        ).filter( (part) => {return part !== ""});

        expect(resStr.join(" ")).to.equals(expected.join(" "));
    }).then(done, done);
}

function makeTests(specPath: string) {
    var YAML = require("js-yaml");
    var fs = require("fs");
    var path = require('path');
    var spec = fs.readFileSync(specPath);
    let tests = YAML.safeLoad(spec);
    let testsRoot = path.dirname(specPath);
    
    for (let test of tests) {
        it("should pass " + test["doc"], (done) => {
            let tool = YAML.safeLoad(fs.readFileSync(path.join(testsRoot, test["tool"])));<commit_msg>hardcoding test resources (for now)<commit_after>import {expect, assert} from "chai";
import {V1CommandLineToolModel} from "./V1CommandLineToolModel";
import { CommandLineTool } from "../../mappings/v1.0/CommandLineTool";
import { CommandLinePart } from "../helpers/CommandLinePart";

function runTest(app: CommandLineTool, job: any, expected: CommandLinePart[], done) {
    let model = new V1CommandLineToolModel(app);
    model.setJob(job);
    model.setRuntime({"cores": 4})
    model.generateCommandLineParts().then((result) => {
        let resStr = result.map(
            (part) => {return part.value}
        ).filter( (part) => {return part !== ""});

        expect(resStr.join(" ")).to.equals(expected.join(" "));
    }).then(done, done);
}

function makeTests(specPath: string) {
    var YAML = require("js-yaml");
    var fs = require("fs");
    var path = require('path');
    var spec = fs.readFileSync(specPath);
    let tests = YAML.safeLoad(spec);
    let testsRoot = path.dirname(specPath);
    
    for (let test of tests) {
        it("should pass " + test["doc"], (done) => {
            let tool = YAML.safeLoad(fs.readFileSync(path.join(testsRoot, test["tool"])));
{'fraction_non_alphanumeric': 0.16817593790426907, 'fraction_numerical': 0.004743423889607589, 'mean_word_length': 3.5849802371541504, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 11, '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': '5135791', 'n_tokens_mistral': 725, 'n_tokens_neox': 718, 'n_words': 163}