diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-20 00:56:46 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-20 00:56:46 +0800 |
commit | 11bac66046e10cd152d328f03f97e04c10d9a40c (patch) | |
tree | 926741e9383264f5c121dc8f046adfabde699eec /packages/sol-cov/test/utils_test.ts | |
parent | e4ea6e1ec3693b2106b1ba28869277488ebca6d3 (diff) | |
parent | 2a438419ab3bc32dba43918cf2eb480439ef81de (diff) | |
download | dexon-sol-tools-11bac66046e10cd152d328f03f97e04c10d9a40c.tar dexon-sol-tools-11bac66046e10cd152d328f03f97e04c10d9a40c.tar.gz dexon-sol-tools-11bac66046e10cd152d328f03f97e04c10d9a40c.tar.bz2 dexon-sol-tools-11bac66046e10cd152d328f03f97e04c10d9a40c.tar.lz dexon-sol-tools-11bac66046e10cd152d328f03f97e04c10d9a40c.tar.xz dexon-sol-tools-11bac66046e10cd152d328f03f97e04c10d9a40c.tar.zst dexon-sol-tools-11bac66046e10cd152d328f03f97e04c10d9a40c.zip |
Merge branch 'development' into feature/sra-report/collection-tests
* development: (26 commits)
Change title
Add Blake and Zach to About page
Re-size Jacob and Tom's images
Manually publish 0x.js back to a working state
Publish
Publish
Fix 0x.js assets
Remove assets from connect and _bundles from packages that don't generate the folder
Publish
Fix packages that aren't working as expected
Make new packages default to public on publish
Add new public packages to top-level README
Update top-level package.json
Fix incorrect new versions
Fix path to assets
Publish
Updated CHANGELOGS
Fix quotation marks
Add a complex test for ast visitor
Move opcodes to constants
...
Diffstat (limited to 'packages/sol-cov/test/utils_test.ts')
-rw-r--r-- | packages/sol-cov/test/utils_test.ts | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/sol-cov/test/utils_test.ts b/packages/sol-cov/test/utils_test.ts new file mode 100644 index 000000000..6fc8fcfe1 --- /dev/null +++ b/packages/sol-cov/test/utils_test.ts @@ -0,0 +1,53 @@ +import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import 'mocha'; + +import { utils } from '../src/utils'; + +chai.use(dirtyChai); +const expect = chai.expect; + +describe('utils', () => { + describe('#compareLineColumn', () => { + it('correctly compares LineColumns', () => { + expect(utils.compareLineColumn({ line: 1, column: 3 }, { line: 1, column: 4 })).to.be.lessThan(0); + expect(utils.compareLineColumn({ line: 1, column: 4 }, { line: 1, column: 3 })).to.be.greaterThan(0); + expect(utils.compareLineColumn({ line: 1, column: 3 }, { line: 1, column: 3 })).to.be.equal(0); + expect(utils.compareLineColumn({ line: 0, column: 2 }, { line: 1, column: 0 })).to.be.lessThan(0); + expect(utils.compareLineColumn({ line: 1, column: 0 }, { line: 0, column: 2 })).to.be.greaterThan(0); + }); + }); + + describe('#isRangeInside', () => { + it('returns true if inside', () => { + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 2 }, end: { line: 1, column: 5 } }, + ), + ).to.be.true(); + }); + it('returns true if the same', () => { + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + ), + ).to.be.true(); + }); + it('returns false if not inside', () => { + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 4 }, end: { line: 1, column: 4 } }, + ), + ).to.be.false(); + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 4 }, end: { line: 1, column: 5 } }, + ), + ).to.be.false(); + }); + }); +}); |