Select Git revision
Forked from
Brady James Garvin / rest_with_post
Source project has a limited visibility.
texMath.test.js 7.55 KiB
import { parallelMapReduce } from './mapReduce.js';
describe('map-reduce with the TeX math monoid', () => {
test('validates the empty string with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '', 1);
expect(result.valid).toBe(true);
});
test('validates no math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', 'xyz', 1);
expect(result.valid).toBe(true);
});
test('validates inline math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$y$z', 1);
expect(result.valid).toBe(true);
});
test('does not validate broken inline math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$y$z$', 1);
expect(result.valid).toBe(false);
});
test('validates consecutive inline math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$y$', 1);
expect(result.valid).toBe(true);
});
test('validates display math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$$y$$z', 1);
expect(result.valid).toBe(true);
});
test('does not validate broken display math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$$y$$z$$', 1);
expect(result.valid).toBe(false);
});
test('validates consecutive display math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$$$$y$$', 1);
expect(result.valid).toBe(true);
});
test('validates inline math followed by display math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$$y$$', 1);
expect(result.valid).toBe(true);
});
test('validates display math followed by inline math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$$$y$', 1);
expect(result.valid).toBe(true);
});
test('does not validate a lone dollar sign ending display math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$', 1);
expect(result.valid).toBe(false);
});
test('does not validate a lone dollar sign inside display math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$y$$', 1);
expect(result.valid).toBe(false);
});
test('does not validate a double dollar sign ending inline math with one thread', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$y$$', 1);
expect(result.valid).toBe(false);
});
test('validates the empty string with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '', 2);
expect(result.valid).toBe(true);
});
test('validates no math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'xyz', 2);
expect(result.valid).toBe(true);
});
test('validates inline math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$y$z', 2);
expect(result.valid).toBe(true);
});
test('does not validate broken inline math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$y$z$', 2);
expect(result.valid).toBe(false);
});
test('validates consecutive inline math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$y$', 2);
expect(result.valid).toBe(true);
});
test('validates display math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$$y$$z', 2);
expect(result.valid).toBe(true);
});
test('does not validate broken display math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$$y$$z$$', 2);
expect(result.valid).toBe(false);
});
test('validates consecutive display math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$$$$y$$', 2);
expect(result.valid).toBe(true);
});
test('validates inline math followed by display math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$$y$$', 2);
expect(result.valid).toBe(true);
});
test('validates display math followed by inline math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$$$y$', 2);
expect(result.valid).toBe(true);
});
test('does not validate a lone dollar sign ending display math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$', 2);
expect(result.valid).toBe(false);
});
test('does not validate a lone dollar sign inside display math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$y$$', 2);
expect(result.valid).toBe(false);
});
test('does not validate a double dollar sign ending inline math with two threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$y$$', 2);
expect(result.valid).toBe(false);
});
test('validates the empty string with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '', 3);
expect(result.valid).toBe(true);
});
test('validates no math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'xyz', 3);
expect(result.valid).toBe(true);
});
test('validates inline math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$y$z', 3);
expect(result.valid).toBe(true);
});
test('does not validate broken inline math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$y$z$', 3);
expect(result.valid).toBe(false);
});
test('validates consecutive inline math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$y$', 3);
expect(result.valid).toBe(true);
});
test('validates display math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$$y$$z', 3);
expect(result.valid).toBe(true);
});
test('does not validate broken display math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', 'x$$y$$z$$', 3);
expect(result.valid).toBe(false);
});
test('validates consecutive display math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$$$$y$$', 3);
expect(result.valid).toBe(true);
});
test('validates inline math followed by display math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$$y$$', 3);
expect(result.valid).toBe(true);
});
test('validates display math followed by inline math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$$$y$', 3);
expect(result.valid).toBe(true);
});
test('does not validate a lone dollar sign ending display math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$', 3);
expect(result.valid).toBe(false);
});
test('does not validate a lone dollar sign inside display math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$$x$y$$', 3);
expect(result.valid).toBe(false);
});
test('does not validate a double dollar sign ending inline math with three threads', async() => {
const result = await parallelMapReduce('./texMath.js', '$x$$y$$', 3);
expect(result.valid).toBe(false);
});
});