@@ -3,10 +3,14 @@ import { version, openFile, TSelector } from 'jsroot';
33import { readHeaderFooter , readEntry , rntupleProcess } from 'jsroot/rntuple' ;
44
55console . log ( `JSROOT version ${ version } ` ) ;
6- // const file = await openFile('https://jsroot.gsi.de/files/tmp/ntpl001_staff.root'),
7- // rntuple = await file.readObject('Staff');
8- const file = await openFile ( './rntuple_test.root' ) ,
9- rntuple = await file . readObject ( 'Data' ) ;
6+
7+
8+ let filename = './rntuple_test.root' ;
9+ if ( process ?. argv && process . argv [ 2 ] )
10+ filename = process . argv [ 2 ] ;
11+
12+ const file = await openFile ( filename ) ,
13+ rntuple = await file . readObject ( 'Data' ) ;
1014
1115await readHeaderFooter ( rntuple ) ;
1216
@@ -41,11 +45,11 @@ else {
4145 else
4246 console . log ( `OK: Field ${ i } : ${ field . fieldName } (${ field . typeName } )` ) ;
4347 if ( i === 0 ) {
44- if ( field . fieldName !== 'IntField' || field . typeName !== 'std::int32_t' )
45- console . error ( `FAILURE: First field should be 'IntField (std::int32_t)' but got '${ field . fieldName } (${ field . typeName } )'` ) ;
48+ if ( field . fieldName !== 'IntField' || field . typeName !== 'std::int32_t' )
49+ console . error ( `FAILURE: First field should be 'IntField (std::int32_t)' but got '${ field . fieldName } (${ field . typeName } )'` ) ;
4650 } else if ( i === rntuple . builder . fieldDescriptors . length - 1 ) {
4751 if ( field . fieldName !== 'StringField' || field . typeName !== 'std::string' )
48- console . error ( `FAILURE: Last field should be 'StringField (std::string)' but got '${ field . fieldName } (${ field . typeName } )'` ) ;
52+ console . error ( `FAILURE: Last field should be 'StringField (std::string)' but got '${ field . fieldName } (${ field . typeName } )'` ) ;
4953 }
5054 }
5155}
@@ -93,7 +97,7 @@ const EPSILON = 1e-10;
9397
9498for ( let entryIndex = 0 ; entryIndex < 10 ; ++ entryIndex ) {
9599 console . log ( `\nChecking entry ${ entryIndex } :` ) ;
96-
100+
97101 const expected = {
98102 IntField : entryIndex ,
99103 FloatField : entryIndex * entryIndex ,
0 commit comments