forked from llipio/algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 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 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 |
---|---|---|
@@ -1,16 +1,35 @@ | ||
const expect = require('chai').expect; | ||
let solution = require('../solutions/15').solution; | ||
let solution1 = require('../solutions/15').solution1; | ||
// solution = require('../yourSolution').solution; | ||
|
||
describe('is substring', () => { | ||
it('should return true if second input is a substring of first input', () => { | ||
const result = solution('all your base are belong to us', 'ase ar'); | ||
let result = solution('all your base are belong to us', 'ase ar'); | ||
expect(result).to.equal(true); | ||
result = solution1('all your base are belong to us', 'ase ar'); | ||
expect(result).to.equal(true); | ||
}); | ||
|
||
it('should return false is second input is NOT a substring of first input', | ||
() => { | ||
const result = solution('i love tacos more than you', 'carne asada'); | ||
let result = solution('i love tacos more than you', 'carne asada'); | ||
expect(result).to.equal(false); | ||
result = solution1('i love tacos more than you', 'carne asada'); | ||
expect(result).to.equal(false); | ||
}); | ||
|
||
it('should return true if second input is a substring of the first input', () => { | ||
let result = solution('ab cd ef g', 'ef'); | ||
expect(result).to.equal(true); | ||
result = solution1('ab cd ef g', 'ef'); | ||
expect(result).to.equal(true); | ||
}); | ||
|
||
it('should return false if second input is NOT a substring of first input', () => { | ||
let result = solution('can', 'cn'); | ||
expect(result).to.equal(false); | ||
result = solution1('can', 'cn'); | ||
expect(result).to.equal(false); | ||
}); | ||
}); |