Implement unit tests for the numberToString
utility function
This commit is contained in:
parent
a6dfcc89fa
commit
9e3adb5ec7
@ -22,6 +22,7 @@ import {
|
||||
isAscii,
|
||||
isWhiteSpace,
|
||||
log2,
|
||||
numberToString,
|
||||
parseXFAPath,
|
||||
recoverJsURL,
|
||||
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 () {
|
||||
it("handles space characters", function () {
|
||||
expect(isWhiteSpace(0x20)).toEqual(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user