mirror of
https://github.com/morluto/rea.git
synced 2026-11-30 02:17:09 +00:00
test(fixtures): share little-endian integer buffers (#14432)
This commit is contained in:
1 parent
adb4679449
commit
1e5cdbc7ee
12 files changed
+54
-90
No files matched your search
@@ -1,18 +1,12 @@
|
||||
import {
|
||||
uint32LE as u32,
|
||||
int32LE as i32,
|
||||
} from "../native/BinaryInteger.fixture.js";
|
||||
import type { PythonPycCodeLayout } from "../domain/python/pythonPyc.js";
|
||||
|
||||
const FLAG_REF = 0x80;
|
||||
|
||||
const u8 = (value: number): Buffer => Buffer.from([value]);
|
||||
const u32 = (value: number): Buffer => {
|
||||
const bytes = Buffer.alloc(4);
|
||||
bytes.writeUInt32LE(value);
|
||||
return bytes;
|
||||
};
|
||||
const i32 = (value: number): Buffer => {
|
||||
const bytes = Buffer.alloc(4);
|
||||
bytes.writeInt32LE(value);
|
||||
return bytes;
|
||||
};
|
||||
const concat = (...parts: Buffer[]): Buffer => Buffer.concat(parts);
|
||||
|
||||
/** 16-byte CPython 3.7+ pyc header. Hash-based pycs store an 8-byte source hash. */
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
uint32LE as u32,
|
||||
int32LE as i32,
|
||||
} from "../native/BinaryInteger.fixture.js";
|
||||
import { createHash } from "node:crypto";
|
||||
import { expect, it } from "vitest";
|
||||
import {
|
||||
@@ -484,16 +488,6 @@ it("classifies the 12-byte 3.7 alpha header as unsupported", () => {
|
||||
}
|
||||
});
|
||||
|
||||
const u32 = (value: number): Buffer => {
|
||||
const bytes = Buffer.alloc(4);
|
||||
bytes.writeUInt32LE(value);
|
||||
return bytes;
|
||||
};
|
||||
const i32 = (value: number): Buffer => {
|
||||
const bytes = Buffer.alloc(4);
|
||||
bytes.writeInt32LE(value);
|
||||
return bytes;
|
||||
};
|
||||
const f64 = (value: number): Buffer => {
|
||||
const bytes = Buffer.alloc(8);
|
||||
bytes.writeDoubleLE(value);
|
||||
|
||||
Reference in new issue
Block a user