forked from luoxuhai/pcl.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadPCDHeader.test.ts
27 lines (23 loc) · 1015 Bytes
/
readPCDHeader.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import fs from 'fs';
import path from 'path';
import * as PCL from '../../';
import { writeFile } from '../utils';
describe('readPCDHeader', () => {
it('should read the header of a PCD file with an x,y,z field', async () => {
const filename = 'ism_test_cat.pcd';
writeFile(filename, PCL.fs);
const header = PCL.readPCDFileHeader(filename);
expect(header?.fields).toEqual(['x', 'y', 'z']);
});
it('should read the header of a PCD file with an x,y,x,intensity,distance,sid field', async () => {
const filename = 'table_scene_lms400.pcd';
writeFile(filename, PCL.fs);
const header = PCL.readPCDFileHeader(filename);
expect(header?.fields).toEqual(['x', 'y', 'z', 'intensity', 'distance', 'sid']);
});
it('should read the header of a PCD file using readPCDHeader', async () => {
const data = fs.readFileSync(path.join(global.ROOT_DIR, `data/ism_test_cat.pcd`));
const header = PCL.readPCDHeader(data);
expect(header?.fields).toEqual(['x', 'y', 'z']);
});
});