-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.test.js
34 lines (29 loc) · 998 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {test} from 'uvu';
import * as assert from 'uvu/assert';
import xor from './index.js';
test('not enough arguments', () => {
assert.is(xor(), false);
assert.is(xor(undefined), false);
assert.is(xor(null), false);
assert.is(xor(true), false);
assert.is(xor(false), false);
});
test('2 args', () => {
assert.is(xor(undefined, undefined), false);
assert.is(xor(undefined, true), true);
assert.is(xor(null, true), true);
assert.is(xor(true, false), true);
assert.is(xor(false, true), true);
assert.is(xor(true, true), false);
assert.is(xor(false, false), false);
});
test('many arguments', () => {
assert.is(xor(true, false, false), true);
assert.is(xor(true, true, true), false);
assert.is(xor(true, true, false), false);
assert.is(xor(false, false, false), false);
assert.is(xor(undefined, true, false, false), true);
assert.is(xor(undefined, null, false, false), false);
assert.is(xor(false, false, false, false, false, true), true);
});
test.run();