@foxglove/rosmsg-serialization
Version:
ROS 1 message serialization, for reading and writing bags and network messages
38 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const stringLengthUtf8_1 = require("./stringLengthUtf8");
describe("stringLengthUtf8", () => {
it.each([
"",
"a",
"ab",
"abc",
"abcd",
"béta",
"\xE9",
"\u0000",
"\u007f",
"\u0080",
"\u07ff",
"\u0800",
"\ud800", // lone high surrogate
"\ud800x", // lone high surrogate
"x\ud800", // lone high surrogate
"\ud800\udc00", // surrogate pair, equivalent to "𐀀" or "\u{10000}"
"\udbff\udfff", // surrogate pair, equivalent to "\u{10ffff}"
"\udc00", // lone low surrogate
"\udc00x", // lone low surrogate
"x\udc00", // lone low surrogate
"\u7fff",
"\u8000",
"\u8001",
"\uffff",
"\u{10000}",
"\u{fffff}",
"\u{100000}",
"\u{10ffff}",
])("agrees with TextEncoder", (str) => {
expect((0, stringLengthUtf8_1.stringLengthUtf8)(str)).toEqual(new TextEncoder().encode(str).length);
});
});
//# sourceMappingURL=stringLengthUtf8.test.js.map