mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Implement unit tests for the numberToString
utility function
This commit is contained in:
parent
a6dfcc89fa
commit
9e3adb5ec7
1 changed files with 16 additions and 0 deletions
|
@ -22,6 +22,7 @@ import {
|
||||||
isAscii,
|
isAscii,
|
||||||
isWhiteSpace,
|
isWhiteSpace,
|
||||||
log2,
|
log2,
|
||||||
|
numberToString,
|
||||||
parseXFAPath,
|
parseXFAPath,
|
||||||
recoverJsURL,
|
recoverJsURL,
|
||||||
stringToUTF16HexString,
|
stringToUTF16HexString,
|
||||||
|
@ -182,6 +183,21 @@ describe("core_utils", function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("numberToString", function () {
|
||||||
|
it("should stringify integers", function () {
|
||||||
|
expect(numberToString(1)).toEqual("1");
|
||||||
|
expect(numberToString(0)).toEqual("0");
|
||||||
|
expect(numberToString(-1)).toEqual("-1");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should stringify floats", function () {
|
||||||
|
expect(numberToString(1.0)).toEqual("1");
|
||||||
|
expect(numberToString(1.2)).toEqual("1.2");
|
||||||
|
expect(numberToString(1.23)).toEqual("1.23");
|
||||||
|
expect(numberToString(1.234)).toEqual("1.23");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("isWhiteSpace", function () {
|
describe("isWhiteSpace", function () {
|
||||||
it("handles space characters", function () {
|
it("handles space characters", function () {
|
||||||
expect(isWhiteSpace(0x20)).toEqual(true);
|
expect(isWhiteSpace(0x20)).toEqual(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue