@@ -195,11 +195,11 @@ describe('Writer', () => {
195195describe ( 'u16' , ( ) => {
196196test ( 'writes 16-bit unsigned integer' , ( ) => {
197197const writer = new Writer ( ) ;
198- writer . u16 ( 0xABCD ) ;
198+ writer . u16 ( 0xabcd ) ;
199199expect ( writer . x ) . toBe ( 2 ) ;
200200// Check the values written (assuming little-endian or system endianness)
201201const value = writer . view . getUint16 ( 0 ) ;
202- expect ( value ) . toBe ( 0xABCD ) ;
202+ expect ( value ) . toBe ( 0xabcd ) ;
203203} ) ;
204204} ) ;
205205
@@ -233,10 +233,10 @@ describe('Writer', () => {
233233describe ( 'u64' , ( ) => {
234234test ( 'writes 64-bit unsigned integer as number' , ( ) => {
235235const writer = new Writer ( ) ;
236- writer . u64 ( 0x1234567890ABCDEF ) ;
236+ writer . u64 ( 0x1234567890abcdef ) ;
237237expect ( writer . x ) . toBe ( 8 ) ;
238238const value = writer . view . getBigUint64 ( 0 ) ;
239- expect ( value ) . toBe ( BigInt ( 0x1234567890ABCDEF ) ) ;
239+ expect ( value ) . toBe ( BigInt ( 0x1234567890abcdef ) ) ;
240240} ) ;
241241
242242test ( 'writes 64-bit unsigned integer as bigint' , ( ) => {
@@ -267,9 +267,9 @@ describe('Writer', () => {
267267describe ( 'u8u16' , ( ) => {
268268test ( 'writes byte and 16-bit word' , ( ) => {
269269const writer = new Writer ( ) ;
270- writer . u8u16 ( 0xFF , 0x1234 ) ;
270+ writer . u8u16 ( 0xff , 0x1234 ) ;
271271expect ( writer . x ) . toBe ( 3 ) ;
272- expect ( writer . uint8 [ 0 ] ) . toBe ( 0xFF ) ;
272+ expect ( writer . uint8 [ 0 ] ) . toBe ( 0xff ) ;
273273expect ( writer . uint8 [ 1 ] ) . toBe ( 0x12 ) ;
274274expect ( writer . uint8 [ 2 ] ) . toBe ( 0x34 ) ;
275275} ) ;
@@ -278,27 +278,27 @@ describe('Writer', () => {
278278describe ( 'u8u32' , ( ) => {
279279test ( 'writes byte and 32-bit dword' , ( ) => {
280280const writer = new Writer ( ) ;
281- writer . u8u32 ( 0xAA , 0x12345678 ) ;
281+ writer . u8u32 ( 0xaa , 0x12345678 ) ;
282282expect ( writer . x ) . toBe ( 5 ) ;
283- expect ( writer . uint8 [ 0 ] ) . toBe ( 0xAA ) ;
283+ expect ( writer . uint8 [ 0 ] ) . toBe ( 0xaa ) ;
284284} ) ;
285285} ) ;
286286
287287describe ( 'u8u64' , ( ) => {
288288test ( 'writes byte and 64-bit qword' , ( ) => {
289289const writer = new Writer ( ) ;
290- writer . u8u64 ( 0xFF , 0x123456789ABCDEF0 ) ;
290+ writer . u8u64 ( 0xff , 0x123456789abcdef0 ) ;
291291expect ( writer . x ) . toBe ( 9 ) ;
292- expect ( writer . uint8 [ 0 ] ) . toBe ( 0xFF ) ;
292+ expect ( writer . uint8 [ 0 ] ) . toBe ( 0xff ) ;
293293} ) ;
294294} ) ;
295295
296296describe ( 'u8f32' , ( ) => {
297297test ( 'writes byte and 32-bit float' , ( ) => {
298298const writer = new Writer ( ) ;
299- writer . u8f32 ( 0xAA , 1.5 ) ;
299+ writer . u8f32 ( 0xaa , 1.5 ) ;
300300expect ( writer . x ) . toBe ( 5 ) ;
301- expect ( writer . uint8 [ 0 ] ) . toBe ( 0xAA ) ;
301+ expect ( writer . uint8 [ 0 ] ) . toBe ( 0xaa ) ;
302302const value = writer . view . getFloat32 ( 1 ) ;
303303expect ( value ) . toBeCloseTo ( 1.5 ) ;
304304} ) ;
@@ -307,9 +307,9 @@ describe('Writer', () => {
307307describe ( 'u8f64' , ( ) => {
308308test ( 'writes byte and 64-bit float' , ( ) => {
309309const writer = new Writer ( ) ;
310- writer . u8f64 ( 0xBB , 3.14159 ) ;
310+ writer . u8f64 ( 0xbb , 3.14159 ) ;
311311expect ( writer . x ) . toBe ( 9 ) ;
312- expect ( writer . uint8 [ 0 ] ) . toBe ( 0xBB ) ;
312+ expect ( writer . uint8 [ 0 ] ) . toBe ( 0xbb ) ;
313313const value = writer . view . getFloat64 ( 1 ) ;
314314expect ( value ) . toBeCloseTo ( 3.14159 ) ;
315315} ) ;
@@ -557,14 +557,7 @@ describe('Writer', () => {
557557
558558test ( 'encodes to same bytes as TextEncoder' , ( ) => {
559559const writer = new Writer ( ) ;
560- const testStrings = [
561- 'Hello' ,
562- 'café' ,
563- '你好' ,
564- '👍' ,
565- 'Привет' ,
566- 'mixed: Hello мир 世界 🌍' ,
567- ] ;
560+ const testStrings = [ 'Hello' , 'café' , '你好' , '👍' , 'Привет' , 'mixed: Hello мир 世界 🌍' ] ;
568561
569562for ( const str of testStrings ) {
570563writer . newBuffer ( str . length * 4 + 1 ) ;
@@ -579,12 +572,7 @@ describe('Writer', () => {
579572
580573test ( 'handles consecutive writes' , ( ) => {
581574const writer = new Writer ( ) ;
582- const strings = [
583- 'Hello ' ,
584- 'мир ' ,
585- '世界 ' ,
586- '👍' ,
587- ] ;
575+ const strings = [ 'Hello ' , 'мир ' , '世界 ' , '👍' ] ;
588576let totalLength = 0 ;
589577for ( const str of strings ) {
590578const len = writer . utf8 ( str ) ;
@@ -617,13 +605,7 @@ describe('Writer', () => {
617605
618606test ( 'stress test: alternating small and large strings' , ( ) => {
619607const writer = new Writer ( 10 ) ; // Small initial buffer
620- const strings = [
621- 'a' ,
622- '😀' . repeat ( 1000 ) ,
623- 'test' ,
624- '中国' . repeat ( 500 ) ,
625- '!' ,
626- ] ;
608+ const strings = [ 'a' , '😀' . repeat ( 1000 ) , 'test' , '中国' . repeat ( 500 ) , '!' ] ;
627609
628610for ( const str of strings ) {
629611writer . ensureCapacity ( str . length * 4 ) ;
@@ -647,13 +629,7 @@ describe('Writer', () => {
647629
648630test ( 'matches TextEncoder output' , ( ) => {
649631const writer = new Writer ( ) ;
650- const testStrings = [
651- 'simple' ,
652- 'café' ,
653- '日本語' ,
654- '😀' ,
655- 'мир' ,
656- ] ;
632+ const testStrings = [ 'simple' , 'café' , '日本語' , '😀' , 'мир' ] ;
657633
658634for ( const str of testStrings ) {
659635writer . newBuffer ( str . length * 4 + 1 ) ;
@@ -671,7 +647,7 @@ describe('Writer', () => {
671647writer . u8 ( 42 ) ;
672648writer . u16 ( 0x1234 ) ;
673649writer . utf8 ( 'test' ) ;
674- writer . u32 ( 0xDEADBEEF ) ;
650+ writer . u32 ( 0xdeadbeef ) ;
675651expect ( writer . x ) . toBeGreaterThan ( 0 ) ;
676652} ) ;
677653