@@ -725,6 +725,48 @@ def test_cpp_tls_example(self):
725
725
'cpp_trades_tls_ca' ,
726
726
tls = True )
727
727
728
+ def test_cpp_array_example (self ):
729
+ self ._test_array_example (
730
+ 'line_sender_cpp_example_array' ,
731
+ 'cpp_market_orders' )
732
+
733
+ def test_c_array_example (self ):
734
+ self ._test_array_example (
735
+ 'line_sender_c_example_array' ,
736
+ 'market_orders' )
737
+
738
+ def _test_array_example (self , bin_name , table_name ):
739
+ if QDB_FIXTURE .version < (8 , 3 , 1 ):
740
+ self .skipTest ('array unsupported' )
741
+ if QDB_FIXTURE .http :
742
+ self .skipTest ('TCP-only test' )
743
+ if BUILD_MODE != qls .BuildMode .API :
744
+ self .skipTest ('BuildMode.API-only test' )
745
+ if QDB_FIXTURE .auth :
746
+ self .skipTest ('auth' )
747
+
748
+ proj = Project ()
749
+ ext = '.exe' if sys .platform == 'win32' else ''
750
+ try :
751
+ bin_path = next (proj .build_dir .glob (f'**/{ bin_name } { ext } ' ))
752
+ except StopIteration :
753
+ raise RuntimeError (f'Could not find { bin_name } { ext } in { proj .build_dir } ' )
754
+ port = QDB_FIXTURE .line_tcp_port
755
+ args = [str (bin_path )]
756
+ args .extend (['localhost' , str (port )])
757
+ subprocess .check_call (args , cwd = bin_path .parent )
758
+ resp = retry_check_table (table_name )
759
+ exp_columns = [
760
+ {'name' : 'symbol' , 'type' : 'SYMBOL' },
761
+ {'dim' : 3 , 'elemType' : 'DOUBLE' , 'name' : 'order_book' , 'type' : 'ARRAY' },
762
+ {'name' : 'timestamp' , 'type' : 'TIMESTAMP' }]
763
+ self .assertEqual (resp ['columns' ], exp_columns )
764
+ exp_dataset = [['BTC-USD' ,
765
+ [[[48123.5 , 2.4 ], [48124.0 , 1.8 ], [48124.5 , 0.9 ]],
766
+ [[48122.5 , 3.1 ], [48122.0 , 2.7 ], [48121.5 , 4.3 ]]]]]
767
+ scrubbed_dataset = [row [:- 1 ] for row in resp ['dataset' ]]
768
+ self .assertEqual (scrubbed_dataset , exp_dataset )
769
+
728
770
def test_opposite_auth (self ):
729
771
"""
730
772
We simulate incorrectly connecting either:
0 commit comments