@anselan/maprange
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -19,2 +19,30 @@ "use strict"; | ||
}); | ||
describe('pixel values', () => { | ||
test('far left', () => { | ||
const value = 0; | ||
expect(_1.default(value, 0, 1, 0, 1920)).toBe(0); | ||
}); | ||
test('leftish', () => { | ||
const value = 0.25; | ||
expect(_1.default(value, 0, 1, 0, 1920)).toBe(480); | ||
}); | ||
test('far right', () => { | ||
const value = 1.0; | ||
expect(_1.default(value, 0, 1, 0, 1920)).toBe(1920); | ||
}); | ||
}); | ||
describe('negative values', () => { | ||
test('middle is 0', () => { | ||
const value = 0.5; | ||
expect(_1.default(value, 0, 1, -1, 1)).toBe(0); | ||
}); | ||
test('leftish', () => { | ||
const value = 0.25; | ||
expect(_1.default(value, 0, 1, -1000, 1000)).toBe(-500); | ||
}); | ||
test('far right', () => { | ||
const value = 80; | ||
expect(_1.default(value, 0, 100, -100, 100)).toBe(60); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
{ | ||
"name": "@anselan/maprange", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Map values from one range to another", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,2 +17,32 @@ import remap from '.' | ||
}) | ||
describe('pixel values', () => { | ||
test('far left', () => { | ||
const value = 0; | ||
expect(remap(value, 0, 1, 0, 1920)).toBe(0) | ||
}) | ||
test('leftish', () => { | ||
const value = 0.25; | ||
expect(remap(value, 0, 1, 0, 1920)).toBe(480) | ||
}) | ||
test('far right', () => { | ||
const value = 1.0; | ||
expect(remap(value, 0, 1, 0, 1920)).toBe(1920) | ||
}) | ||
}) | ||
describe('negative values', () => { | ||
test('middle is 0', () => { | ||
const value = 0.5; | ||
expect(remap(value, 0, 1, -1, 1)).toBe(0); | ||
}) | ||
test('leftish', () => { | ||
const value = 0.25; | ||
expect(remap(value, 0, 1, -1000, 1000)).toBe(-500) | ||
}) | ||
test('far right', () => { | ||
const value = 80; | ||
expect(remap(value, 0, 100, -100, 100)).toBe(60) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7658
145