Skip to content
Snippets Groups Projects
Commit 78c7664b authored by Alexander Rose's avatar Alexander Rose
Browse files

very basic ccp4 spec test

parent 39b29fe0
No related branches found
No related tags found
No related merge requests found
...@@ -6,19 +6,37 @@ ...@@ -6,19 +6,37 @@
import * as CCP4 from '../ccp4/parser' import * as CCP4 from '../ccp4/parser'
const ccp4Buffer = new Uint8Array(4 * 64) function createCcp4Data() {
const data = new Uint8Array(4 * 256 + 6)
const dv = new DataView(data.buffer)
dv.setInt8(52 * 4, 'M'.charCodeAt(0))
dv.setInt8(52 * 4 + 1, 'A'.charCodeAt(0))
dv.setInt8(52 * 4 + 2, 'P'.charCodeAt(0))
dv.setInt8(52 * 4 + 3, ' '.charCodeAt(0))
dv.setInt32(0 * 4, 1) // NC
dv.setInt32(1 * 4, 2) // NR
dv.setInt32(2 * 4, 3) // NS
return data
}
describe('ccp4 reader', () => { describe('ccp4 reader', () => {
it('basic', async () => { it('basic', async () => {
const parsed = await CCP4.parse(ccp4Buffer).run(); const data = createCcp4Data()
const parsed = await CCP4.parse(data).run();
if (parsed.isError) { if (parsed.isError) {
console.log(parsed) throw new Error(parsed.message)
return;
} }
// const ccp4File = parsed.result;
// const { header, values } = ccp4File;
// TODO const ccp4File = parsed.result;
const { header } = ccp4File;
expect(header.NC).toBe(1)
expect(header.NR).toBe(2)
expect(header.NS).toBe(3)
}); });
}); });
...@@ -10,7 +10,6 @@ function createDcdData() { ...@@ -10,7 +10,6 @@ function createDcdData() {
const data = new Uint8Array(4 * 128) const data = new Uint8Array(4 * 128)
const dv = new DataView(data.buffer) const dv = new DataView(data.buffer)
// const intView = new Int32Array(data.buffer, 0, 23)
// set little endian // set little endian
dv.setInt32(0, 84) dv.setInt32(0, 84)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment