@@ -371,84 +371,3 @@ Test( oracle, upd_aggregate ) {
371371 cr_assert ( px -> prev_conf_ == prev_conf_ );
372372 cr_assert ( px -> prev_timestamp_ == prev_timestamp_ );
373373}
374-
375- Test ( oracle , del_publisher ) {
376- pc_price_info_t p1 = { .price_ = 100 , .conf_ = 10 ,
377- .status_ = PC_STATUS_TRADING , .pub_slot_ = 42 };
378- pc_price_info_t p2 = { .price_ = 200 , .conf_ = 20 ,
379- .status_ = PC_STATUS_TRADING , .pub_slot_ = 42 };
380-
381- // start with perfect inputs
382- pc_pub_key_t p_id = { .k8_ = { 1 , 2 , 3 , 4 } };
383- pc_pub_key_t p_id2 = { .k8_ = { 2 , 3 , 4 , 5 } };
384- pc_pub_key_t p_id3 = { .k8_ = { 3 , 4 , 5 , 6 } };
385- cmd_add_publisher_t idata = {
386- .ver_ = PC_VERSION ,
387- .cmd_ = e_cmd_del_publisher ,
388- .pub_ = p_id2
389- };
390- SolPubkey pkey = {.x = { 1 , }};
391- SolPubkey skey = {.x = { 3 , }};
392- uint64_t pqty = 100 ;
393- pc_price_t sptr [1 ];
394- sol_memset ( sptr , 0 , sizeof ( pc_price_t ) );
395- sptr -> magic_ = PC_MAGIC ;
396- sptr -> ver_ = PC_VERSION ;
397- sptr -> ptype_ = PC_PTYPE_PRICE ;
398- sptr -> type_ = PC_ACCTYPE_PRICE ;
399- sptr -> num_ = 1 ;
400- sptr -> comp_ [0 ].latest_ = p1 ;
401- pc_pub_key_assign ( & sptr -> comp_ [0 ].pub_ , (pc_pub_key_t * )& p_id2 );
402-
403- SolAccountInfo acc [] = {{
404- .key = & pkey ,
405- .lamports = & pqty ,
406- .data_len = 0 ,
407- .data = NULL ,
408- .owner = NULL ,
409- .rent_epoch = 0 ,
410- .is_signer = true,
411- .is_writable = true,
412- .executable = false
413- },{
414- .key = & skey ,
415- .lamports = & PRICE_ACCOUNT_LAMPORTS ,
416- .data_len = sizeof ( pc_price_t ),
417- .data = (uint8_t * )sptr ,
418- .owner = (SolPubkey * )& p_id ,
419- .rent_epoch = 0 ,
420- .is_signer = true,
421- .is_writable = true,
422- .executable = false
423- } };
424- SolParameters prm = {
425- .ka = acc ,
426- .ka_num = 2 ,
427- .data = (const uint8_t * )& idata ,
428- .data_len = sizeof ( idata ),
429- .program_id = (SolPubkey * )& p_id
430- };
431- cr_assert ( SUCCESS == dispatch ( & prm , acc ) );
432- cr_assert ( sptr -> num_ == 0 );
433- cr_assert ( sptr -> comp_ [0 ].latest_ .status_ == 0 );
434-
435- sptr -> num_ = 2 ;
436- sptr -> comp_ [0 ].latest_ = p1 ;
437- sptr -> comp_ [1 ].latest_ = p2 ;
438- pc_pub_key_assign ( & sptr -> comp_ [0 ].pub_ , (pc_pub_key_t * )& p_id2 );
439- pc_pub_key_assign ( & sptr -> comp_ [1 ].pub_ , (pc_pub_key_t * )& p_id3 );
440- cr_assert ( SUCCESS == dispatch ( & prm , acc ) );
441- cr_assert ( sptr -> num_ == 1 );
442- cr_assert ( sptr -> comp_ [0 ].latest_ .price_ == p2 .price_ );
443- cr_assert ( sptr -> comp_ [1 ].latest_ .status_ == 0 );
444-
445- sptr -> num_ = 2 ;
446- sptr -> comp_ [0 ].latest_ = p1 ;
447- sptr -> comp_ [1 ].latest_ = p2 ;
448- pc_pub_key_assign ( & sptr -> comp_ [0 ].pub_ , (pc_pub_key_t * )& p_id3 );
449- pc_pub_key_assign ( & sptr -> comp_ [1 ].pub_ , (pc_pub_key_t * )& p_id2 );
450- cr_assert ( SUCCESS == dispatch ( & prm , acc ) );
451- cr_assert ( sptr -> num_ == 1 );
452- cr_assert ( sptr -> comp_ [0 ].latest_ .price_ == p1 .price_ );
453- cr_assert ( sptr -> comp_ [1 ].latest_ .status_ == 0 );
454- }
0 commit comments