Skip to content

Commit

Permalink
🔬 test: Increase coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Apr 14, 2021
1 parent 9787eb3 commit 0e37c59
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion test/src/SAT.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'ava';
import * as sat from '../../src/index.js';

import * as compare from '@aureooms/js-compare';
import {list} from '@aureooms/js-itertools';
import {list, map} from '@aureooms/js-itertools';

const lex = compare.lexicographical(compare.increasing);

Expand Down Expand Up @@ -77,3 +77,32 @@ test('#2', (t) => {
['C', 1],
]);
});

test('#3', (t) => {
const instance = sat.from.signs([
[-1, 2, 3],
[-2, -4, 5],
[1, -5],
]);
const satisfying_assignments = list(
map((certificate) => instance.assignment(certificate), sat.solve(instance)),
);
t.deepEqual(satisfying_assignments, [
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 1, 0, 0],
[0, 0, 0, 1, 1, 0],
[0, 0, 1, 0, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 1, 0, 1, 0, 0],
[0, 1, 0, 1, 0, 1],
[0, 1, 0, 1, 1, 0],
[0, 1, 0, 1, 1, 1],
[0, 1, 1, 0, 0, 0],
[0, 1, 1, 0, 0, 1],
[0, 1, 1, 0, 1, 1],
[0, 1, 1, 1, 0, 0],
[0, 1, 1, 1, 0, 1],
[0, 1, 1, 1, 1, 1],
]);
});

0 comments on commit 0e37c59

Please sign in to comment.