@@ -4,7 +4,7 @@ const vscode = require("vscode");
44const { timer } = require ( "./utils" ) ;
55
66test ( "Can find devices" , async ( ) => {
7- assert ( pymakr . devicesStore . get ( ) . length >= 2 ) ;
7+ assert ( pymakr . devicesStore . get ( ) . length >= 1 ) ;
88
99 test ( "device" , async ( ) => {
1010 const device = pymakr . devicesStore . get ( ) [ 0 ] ;
@@ -43,29 +43,33 @@ test("Can find devices", async () => {
4343 await new Promise ( ( resolve ) => device . readUntil ( [ 'print\\("foo"\\)' , "foo" , ">>> " ] . join ( "\r\n" ) , resolve ) ) ;
4444 } ) ;
4545
46- test ( 'can run large script' , async ( ) => {
47- pymakr . commands . runScript ( readFileSync ( __dirname + '/file-management/_sample/folder/large-file.py' , 'utf8' ) , device )
48- await new Promise ( ( resolve ) => device . readUntil ( 'number is\r\n1000' , resolve ) ) ;
49- } )
50-
51-
52-
53- test ( 'can configure chunking' , async ( ) => {
54- const script = `print('Hello world. How are you today?')\n`
46+ test ( "can run large script" , async ( ) => {
47+ pymakr . commands . runScript (
48+ readFileSync ( __dirname + "/file-management/_sample/folder/large-file.py" , "utf8" ) ,
49+ device
50+ ) ;
51+ await new Promise ( ( resolve ) => device . readUntil ( "number is\r\n1000" , resolve ) ) ;
52+ } ) ;
5553
56- const withoutChunk = await timer ( ( ) => device . runScript ( script ) )
57- await device . _config . set ( { ...device . config , adapterOptions : { chunkSize : 8 , chunkDelay : 15 } } )
58- await device . disconnect ( )
59- await device . connect ( )
60- const withChunk = await timer ( ( ) => device . runScript ( script ) )
61- await device . _config . set ( { ...device . config , adapterOptions : { chunkSize : null , chunkDelay : null } } )
62- await device . disconnect ( )
63- await device . connect ( )
54+ test ( "can configure chunking" , async ( ) => {
55+ const script = `print('Hello world. How are you today?')\n` ;
6456
65- assert . equal ( withChunk . result , 'Hello world. How are you today?' )
66- assert . equal ( withoutChunk . result , 'Hello world. How are you today?' )
67- assert ( withChunk . time > ( withoutChunk . time * 1.5 ) , `Chunking should be slower ${ withChunk . time } > (${ withoutChunk . time } * 1.5)` )
68- } )
57+ const withoutChunk = await timer ( ( ) => device . runScript ( script ) ) ;
58+ await device . _config . set ( { ...device . config , adapterOptions : { chunkSize : 8 , chunkDelay : 15 } } ) ;
59+ await device . disconnect ( ) ;
60+ await device . connect ( ) ;
61+ const withChunk = await timer ( ( ) => device . runScript ( script ) ) ;
62+ await device . _config . set ( { ...device . config , adapterOptions : { chunkSize : null , chunkDelay : null } } ) ;
63+ await device . disconnect ( ) ;
64+ await device . connect ( ) ;
65+
66+ assert . equal ( withChunk . result , "Hello world. How are you today?" ) ;
67+ assert . equal ( withoutChunk . result , "Hello world. How are you today?" ) ;
68+ assert (
69+ withChunk . time > withoutChunk . time * 1.5 ,
70+ `Chunking should be slower ${ withChunk . time } > (${ withoutChunk . time } * 1.5)`
71+ ) ;
72+ } ) ;
6973
7074 test ( "can disconnect" , async ( ) => {
7175 await device . disconnect ( ) ;
0 commit comments