@@ -77,22 +77,26 @@ describe('Array Creation Functions', () => {
7777 expect ( arr . toArray ( ) ) . toEqual ( [ ] ) ;
7878 } ) ;
7979
80- it ( 'infers int32 dtype for integer args' , ( ) => {
81- expect ( arange ( 10 ) . dtype ) . toBe ( 'int32 ' ) ;
80+ it ( 'defaults to float64 dtype for integer args' , ( ) => {
81+ expect ( arange ( 10 ) . dtype ) . toBe ( 'float64 ' ) ;
8282 } ) ;
8383
84- it ( 'infers int32 dtype for all-integer start/stop/step' , ( ) => {
85- expect ( arange ( 0 , 10 , 1 ) . dtype ) . toBe ( 'int32 ' ) ;
84+ it ( 'defaults to float64 dtype for all-integer start/stop/step' , ( ) => {
85+ expect ( arange ( 0 , 10 , 1 ) . dtype ) . toBe ( 'float64 ' ) ;
8686 } ) ;
8787
88- it ( 'infers float64 dtype for float step' , ( ) => {
88+ it ( 'defaults to float64 dtype for float step' , ( ) => {
8989 expect ( arange ( 0 , 10 , 0.5 ) . dtype ) . toBe ( 'float64' ) ;
9090 } ) ;
9191
92- it ( 'infers float64 dtype when args overflow int32' , ( ) => {
92+ it ( 'defaults to float64 dtype when args overflow int32' , ( ) => {
9393 expect ( arange ( 0 , 3e9 , 1e8 ) . dtype ) . toBe ( 'float64' ) ;
9494 } ) ;
9595
96+ it ( 'honors explicit dtype override' , ( ) => {
97+ expect ( arange ( 0 , 10 , 1 , 'int32' ) . dtype ) . toBe ( 'int32' ) ;
98+ } ) ;
99+
96100 it ( 'respects explicit dtype over inference' , ( ) => {
97101 expect ( arange ( 10 , undefined , 1 , 'float64' ) . dtype ) . toBe ( 'float64' ) ;
98102 } ) ;
@@ -348,16 +352,22 @@ describe('Array Creation Functions', () => {
348352 expect ( arr . dtype ) . toBe ( 'float64' ) ;
349353 } ) ;
350354
351- it ( 'infers float64 dtype for overflow fill value' , ( ) => {
352- expect ( full ( [ 2 ] , 3e9 ) . dtype ) . toBe ( 'float64 ' ) ;
355+ it ( 'infers int64 dtype for overflow fill value' , ( ) => {
356+ expect ( full ( [ 2 ] , 3e9 ) . dtype ) . toBe ( 'int64 ' ) ;
353357 } ) ;
354358
355359 it ( 'infers int32 dtype for max int32 fill value' , ( ) => {
356360 expect ( full ( [ 2 ] , 2147483647 ) . dtype ) . toBe ( 'int32' ) ;
357361 } ) ;
358362
359- it ( 'infers float64 dtype for int32 overflow fill value' , ( ) => {
360- expect ( full ( [ 2 ] , 2147483648 ) . dtype ) . toBe ( 'float64' ) ;
363+ it ( 'infers int64 dtype for int32 overflow fill value' , ( ) => {
364+ expect ( full ( [ 2 ] , 2147483648 ) . dtype ) . toBe ( 'int64' ) ;
365+ } ) ;
366+
367+ it ( 'stores correct value when inferring int64 from a JS number' , ( ) => {
368+ const arr = full ( [ 2 ] , 3e9 ) ;
369+ expect ( arr . get ( [ 0 ] ) ) . toBe ( 3000000000n ) ;
370+ expect ( arr . get ( [ 1 ] ) ) . toBe ( 3000000000n ) ;
361371 } ) ;
362372 } ) ;
363373
0 commit comments