-
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
1 parent
98ec6fd
commit bb3f2b3
Showing
20 changed files
with
333 additions
and
303 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
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,51 +1,45 @@ | ||
import { ceil } from '../src'; | ||
|
||
describe('ceil method', () => { | ||
|
||
test('should return in-range output', () => { | ||
|
||
expect( | ||
ceil(23, 20, 50, 2, 5), | ||
).toBe( | ||
3, | ||
); | ||
|
||
import { expectValues } from './tools/test-values'; | ||
|
||
describe('"ceil" method', () => { | ||
|
||
test('Should return in-range output', () => { | ||
expectValues([ | ||
{ value: 20, expected: 2 }, | ||
{ value: 50, expected: 5 }, | ||
{ value: 30, expected: 3 }, | ||
{ value: 31, expected: 4 }, | ||
{ value: 39, expected: 4 }, | ||
{ value: 40, expected: 4 }, | ||
], ceil, 20, 50, 2, 5); | ||
}); | ||
|
||
test('should return out-range output', () => { | ||
|
||
expect( | ||
ceil(6, 20, 50, 2, 5), | ||
).toBe( | ||
1, | ||
); | ||
|
||
expect( | ||
ceil(62, 20, 50, 2, 5), | ||
).toBe( | ||
7, | ||
); | ||
|
||
test('Should return out-range output', () => { | ||
expectValues([ | ||
{ value: 0, expected: 0 }, | ||
{ value: 4, expected: 1 }, | ||
{ value: 6, expected: 1 }, | ||
{ value: 64, expected: 7 }, | ||
{ value: 66, expected: 7 }, | ||
], ceil, 20, 50, 2, 5); | ||
}); | ||
|
||
test('should invert in-range output', () => { | ||
|
||
expect( | ||
ceil(3.1, 1, 9, 9, 1), | ||
).toBe( | ||
7, | ||
); | ||
|
||
test('Should invert in-range output', () => { | ||
expectValues([ | ||
{ value: 1, expected: 9 }, | ||
{ value: 3.1, expected: 7 }, | ||
{ value: 3.9, expected: 7 }, | ||
{ value: 9, expected: 1 }, | ||
], ceil, 1, 9, 9, 1); | ||
}); | ||
|
||
test('should invert out-range output', () => { | ||
|
||
expect( | ||
ceil(-1.3, 1, 9, 9, 1), | ||
).toBe( | ||
12, | ||
); | ||
|
||
test('Should invert out-range output', () => { | ||
expectValues([ | ||
{ value: -1.3, expected: 12 }, | ||
{ value: -1.9, expected: 12 }, | ||
{ value: 10.1, expected: 0 }, | ||
{ value: 10.9, expected: 0 }, | ||
], ceil, 1, 9, 9, 1); | ||
}); | ||
|
||
}); |
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,51 +1,47 @@ | ||
import { floor } from '../src'; | ||
|
||
describe('floor method', () => { | ||
|
||
test('should return in-range output', () => { | ||
|
||
expect( | ||
floor(23, 20, 50, 2, 5), | ||
).toBe( | ||
2, | ||
); | ||
|
||
import { expectValues } from './tools/test-values'; | ||
|
||
describe('"floor" method', () => { | ||
|
||
test('Should return in-range output', () => { | ||
expectValues([ | ||
{ value: 20, expected: 2 }, | ||
{ value: 50, expected: 5 }, | ||
{ value: 30, expected: 3 }, | ||
{ value: 31, expected: 3 }, | ||
{ value: 39, expected: 3 }, | ||
{ value: 40, expected: 4 }, | ||
], floor, 20, 50, 2, 5); | ||
}); | ||
|
||
test('should return out-range output', () => { | ||
|
||
expect( | ||
floor(6, 20, 50, 2, 5), | ||
).toBe( | ||
0, | ||
); | ||
|
||
expect( | ||
floor(62, 20, 50, 2, 5), | ||
).toBe( | ||
6, | ||
); | ||
|
||
test('Should return out-range output', () => { | ||
expectValues([ | ||
{ value: 4, expected: 0 }, | ||
{ value: 6, expected: 0 }, | ||
{ value: 64, expected: 6 }, | ||
{ value: 66, expected: 6 }, | ||
], floor, 20, 50, 2, 5); | ||
}); | ||
|
||
test('should invert in-range output', () => { | ||
|
||
expect( | ||
floor(3.1, 1, 9, 9, 1), | ||
).toBe( | ||
6, | ||
); | ||
|
||
test('Should invert in-range output', () => { | ||
expectValues([ | ||
{ value: 1, expected: 9 }, | ||
{ value: 4, expected: 6 }, | ||
{ value: 4.1, expected: 5 }, | ||
{ value: 4.9, expected: 5 }, | ||
{ value: 5, expected: 5 }, | ||
{ value: 9, expected: 1 }, | ||
], floor, 1, 9, 9, 1); | ||
}); | ||
|
||
test('should invert out-range output', () => { | ||
|
||
expect( | ||
floor(-1.3, 1, 9, 9, 1), | ||
).toBe( | ||
11, | ||
); | ||
|
||
test('Should invert out-range output', () => { | ||
expectValues([ | ||
{ value: 0, expected: 10 }, | ||
{ value: -0, expected: 10 }, | ||
{ value: -1.3, expected: 11 }, | ||
{ value: 10.1, expected: -1 }, | ||
{ value: 10.9, expected: -1 }, | ||
], floor, 1, 9, 9, 1); | ||
}); | ||
|
||
}); |
Oops, something went wrong.