<commit_before>import chai from 'chai';
import fs from 'fs';
import { GCodeInterpreter } from '../dist/';
import _ from 'lodash';

const expect = chai.expect;
const should = chai.should();

describe('G-code Interpreter', (done) => {
	describe('Pass a null value as the first argument', (done) => {
        class GCodeRunner extends GCodeInterpreter {
            constructor(options) {
                super(options);
            }
        }

        let runner = new GCodeRunner();

		it('should call interpretText\'s callback.', (done) => {
            runner.interpretText(null, (err, results) => {
                expect(err).to.be.okay;
                done();
            });
		});
		it('should call interpretFile\'s callback.', (done) => {
            runner.interpretFile(null, (err, results) => {
                expect(err).to.be.okay;
                done();
            });
		});
		it('should call interpretStream\'s callback.', (done) => {
            runner.interpretStream(null, (err, results) => {
                expect(err).to.be.okay;
                done();
            });
		});
    });

	describe('G-code: circle', (done) => {
        let calls = {};

        class GCodeRunner extends GCodeInterpreter {
            constructor(options) {
                super(options);
            }
            G0(args) {
                calls.G0 = (calls.G0 || 0) + 1;
                expect(args).to.be.an('object');
            }
            G1(args) {
                calls.G1 = (calls.G1 || 0) + 1;
                expect(args).to.be.an('object');
            }
            G2(args) {
                calls.G2 = (calls.G2 || 0) + 1;
                expect(args).to.be.an('object');
            }
        }

		it('should call each function with the expected number of times.', (done) => {
            let runner = new GCodeRunner();
            runner.interpretFile('test/fixtures/circle.nc', (err, results) => {
                expect(calls.G0).to.equal(2);
                expect(calls.G1).to.equal(1);
                expect(calls.G2).to.equal(4);
                done();
            });
        });
    });

	describe('G-code: 1 inch circle', (done) => {
        let calls = {};

        class GCodeRunner extends GCodeInterpreter {
            constructor(options) {
                super(options);
            }
            G17() {
                calls.G17 = (calls.G17 || 0) + 1;
            }
            G20() {
                calls.G20 = (calls.G20 || 0) + 1;
            }
            G90() {
                calls.G90 = (calls.G90 || 0) + 1;
            }
            G94() {
                calls.G94 = (calls.G94 || 0) + 1;
            }
            G54() {
                calls.G54 = (calls.G54 || 0) + 1;
            }
            G0(args) {
                expect(args).to.be.an('object');
                calls.G0 = (calls.G0 || 0) + 1;
            }
            G1(args) {
                expect(args).to.be.an('object');
                calls.G1 = (calls.G1 || 0) + 1;
            }
            G2(args) {
                expect(args).to.be.an('object');
                calls.G2 = (calls.G2 || 0) + 1;
            }
        }

		it('should call each function with the expected number of times.', (done) => {
            let runner = new GCodeRunner();<commit_msg>Convert tabs to spaces<commit_after>import chai from 'chai';
import fs from 'fs';
import { GCodeInterpreter } from '../dist/';
import _ from 'lodash';

const expect = chai.expect;
const should = chai.should();

describe('G-code Interpreter', (done) => {
    describe('Pass a null value as the first argument', (done) => {
        class GCodeRunner extends GCodeInterpreter {
            constructor(options) {
                super(options);
            }
        }

        let runner = new GCodeRunner();

        it('should call interpretText\'s callback.', (done) => {
            runner.interpretText(null, (err, results) => {
                expect(err).to.be.okay;
                done();
            });
        });
        it('should call interpretFile\'s callback.', (done) => {
            runner.interpretFile(null, (err, results) => {
                expect(err).to.be.okay;
                done();
            });
        });
        it('should call interpretStream\'s callback.', (done) => {
            runner.interpretStream(null, (err, results) => {
                expect(err).to.be.okay;
                done();
            });
        });
    });

    describe('G-code: circle', (done) => {
        let calls = {};

        class GCodeRunner extends GCodeInterpreter {
            constructor(options) {
                super(options);
            }
            G0(args) {
                calls.G0 = (calls.G0 || 0) + 1;
                expect(args).to.be.an('object');
            }
            G1(args) {
                calls.G1 = (calls.G1 || 0) + 1;
                expect(args).to.be.an('object');
            }
            G2(args) {
                calls.G2 = (calls.G2 || 0) + 1;
                expect(args).to.be.an('object');
            }
        }

        it('should call each function with the expected number of times.', (done) => {
            let runner = new GCodeRunner();
            runner.interpretFile('test/fixtures/circle.nc', (err, results) => {
                expect(calls.G0).to.equal(2);
                expect(calls.G1).to.equal(1);
                expect(calls.G2).to.equal(4);
                done();
            });
        });
    });

    describe('G-code: 1 inch circle', (done) => {
        let calls = {};

        class GCodeRunner extends GCodeInterpreter {
            constructor(options) {
                super(options);
            }
            G17() {
                calls.G17 = (calls.G17 || 0) + 1;
            }
            G20() {
                calls.G20 = (calls.G20 || 0) + 1;
            }
            G90() {
                calls.G90 = (calls.G90 || 0) + 1;
            }
            G94() {
                calls.G94 = (calls.G94 || 0) + 1;
            }
            G54() {
                calls.G54 = (calls.G54 || 0) + 1;
            }
            G0(args) {
                expect(args).to.be.an('object');
                calls.G0 = (calls.G0 || 0) + 1;
            }
            G1(args) {
                expect(args).to.be.an('object');
                calls.G1 = (calls.G1 || 0) + 1;
            }
            G2(args) {
                expect(args).to.be.an('object');
                calls.G2 = (calls.G2 || 0) + 1;
            }
        }

        it('should call each function with the expected number of times.', (done) => {
            let runner = new GCodeRunner();
{'fraction_non_alphanumeric': 0.15031503150315031, 'fraction_numerical': 0.0231023102310231, 'mean_word_length': 1.2607663614784672, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '7078500', 'n_tokens_mistral': 2068, 'n_tokens_neox': 1959, 'n_words': 392}