-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
not sure what I was thinking before it was over complicated a lot
- Loading branch information
1 parent
a939012
commit cb786a1
Showing
8 changed files
with
78 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { areSetsEqual, mergeSets, setsOverlap, subtractSets } from './sets'; | ||
|
||
describe('Sets', () => { | ||
describe('areSetsEqual', () => { | ||
it('works', () => { | ||
expect(areSetsEqual(new Set(), new Set())).toBe(true); | ||
expect(areSetsEqual(new Set([1]), new Set([]))).toBe(false); | ||
expect(areSetsEqual(new Set([]), new Set([1]))).toBe(false); | ||
expect(areSetsEqual(new Set([1]), new Set([1]))).toBe(true); | ||
expect(areSetsEqual(new Set([1, 2]), new Set([1, 3]))).toBe(false); | ||
expect(areSetsEqual(new Set([2, 1]), new Set([1, 2]))).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('mergeSets', () => { | ||
it('works', () => { | ||
expect([...mergeSets(new Set(), new Set())]).toStrictEqual([]); | ||
expect([...mergeSets(new Set([1]), new Set([2]))].sort()).toStrictEqual([ | ||
1, 2, | ||
]); | ||
expect( | ||
[...mergeSets(new Set([1, 2]), new Set([2]))].sort() | ||
).toStrictEqual([1, 2]); | ||
expect( | ||
[...mergeSets(new Set([1, 2]), new Set([2, 3]))].sort() | ||
).toStrictEqual([1, 2, 3]); | ||
}); | ||
}); | ||
|
||
describe('subtractSets', () => { | ||
it('works', () => { | ||
expect([...subtractSets(new Set(), new Set())]).toStrictEqual([]); | ||
expect( | ||
[...subtractSets(new Set([1]), new Set([2]))].sort() | ||
).toStrictEqual([1]); | ||
expect( | ||
[...subtractSets(new Set([1, 2]), new Set([2]))].sort() | ||
).toStrictEqual([1]); | ||
expect( | ||
[...subtractSets(new Set([1, 2]), new Set([2, 3]))].sort() | ||
).toStrictEqual([1]); | ||
}); | ||
}); | ||
|
||
describe('setsOverlap', () => { | ||
it('works', () => { | ||
expect(setsOverlap(new Set(), new Set())).toBe(false); | ||
expect(setsOverlap(new Set([1]), new Set([]))).toBe(false); | ||
expect(setsOverlap(new Set([]), new Set([1]))).toBe(false); | ||
expect(setsOverlap(new Set([1]), new Set([1]))).toBe(true); | ||
expect(setsOverlap(new Set([1, 2]), new Set([1, 3]))).toBe(true); | ||
expect(setsOverlap(new Set([2, 1]), new Set([1, 2]))).toBe(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.