2
2
#include "accelerator/apis.h"
3
3
#include "test_define.h"
4
4
5
- iota_client_service_t service ;
5
+ static ta_core_t ta_core ;
6
6
struct timespec start_time , end_time ;
7
7
8
8
#if defined(ENABLE_STAT )
@@ -29,7 +29,8 @@ void test_generate_address(void) {
29
29
30
30
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
31
31
clock_gettime (CLOCK_REALTIME , & start_time );
32
- TEST_ASSERT_FALSE (api_generate_address (& service , & json_result ));
32
+ TEST_ASSERT_FALSE (
33
+ api_generate_address (& ta_core .config , & ta_core .service , & json_result ));
33
34
clock_gettime (CLOCK_REALTIME , & end_time );
34
35
#if defined(ENABLE_STAT )
35
36
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -46,7 +47,8 @@ void test_get_tips_pair(void) {
46
47
47
48
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
48
49
clock_gettime (CLOCK_REALTIME , & start_time );
49
- TEST_ASSERT_FALSE (api_get_tips_pair (& service , & json_result ));
50
+ TEST_ASSERT_FALSE (
51
+ api_get_tips_pair (& ta_core .config , & ta_core .service , & json_result ));
50
52
clock_gettime (CLOCK_REALTIME , & end_time );
51
53
#if defined(ENABLE_STAT )
52
54
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -63,7 +65,7 @@ void test_get_tips(void) {
63
65
64
66
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
65
67
clock_gettime (CLOCK_REALTIME , & start_time );
66
- TEST_ASSERT_FALSE (api_get_tips (& service , & json_result ));
68
+ TEST_ASSERT_FALSE (api_get_tips (& ta_core . service , & json_result ));
67
69
clock_gettime (CLOCK_REALTIME , & end_time );
68
70
#if defined(ENABLE_STAT )
69
71
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -85,7 +87,8 @@ void test_send_transfer(void) {
85
87
86
88
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
87
89
clock_gettime (CLOCK_REALTIME , & start_time );
88
- TEST_ASSERT_FALSE (api_send_transfer (& service , json , & json_result ));
90
+ TEST_ASSERT_FALSE (api_send_transfer (& ta_core .config , & ta_core .service , json ,
91
+ & json_result ));
89
92
clock_gettime (CLOCK_REALTIME , & end_time );
90
93
#if defined(ENABLE_STAT )
91
94
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -103,8 +106,8 @@ void test_get_transaction_object(void) {
103
106
clock_gettime (CLOCK_REALTIME , & start_time );
104
107
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
105
108
clock_gettime (CLOCK_REALTIME , & start_time );
106
- TEST_ASSERT_FALSE (
107
- api_get_transaction_object ( & service , TRYTES_81_1 , & json_result ));
109
+ TEST_ASSERT_FALSE (api_get_transaction_object ( & ta_core . service , TRYTES_81_1 ,
110
+ & json_result ));
108
111
clock_gettime (CLOCK_REALTIME , & end_time );
109
112
#if defined(ENABLE_STAT )
110
113
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -122,7 +125,7 @@ void test_find_transactions_by_tag(void) {
122
125
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
123
126
clock_gettime (CLOCK_REALTIME , & start_time );
124
127
TEST_ASSERT_FALSE (
125
- api_find_transactions_by_tag (& service , TAG_MSG , & json_result ));
128
+ api_find_transactions_by_tag (& ta_core . service , TAG_MSG , & json_result ));
126
129
clock_gettime (CLOCK_REALTIME , & end_time );
127
130
#if defined(ENABLE_STAT )
128
131
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -139,8 +142,8 @@ void test_find_transactions_obj_by_tag(void) {
139
142
140
143
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
141
144
clock_gettime (CLOCK_REALTIME , & start_time );
142
- TEST_ASSERT_FALSE (
143
- api_find_transactions_obj_by_tag ( & service , TAG_MSG , & json_result ));
145
+ TEST_ASSERT_FALSE (api_find_transactions_obj_by_tag ( & ta_core . service ,
146
+ TAG_MSG , & json_result ));
144
147
clock_gettime (CLOCK_REALTIME , & end_time );
145
148
#if defined(ENABLE_STAT )
146
149
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -158,7 +161,7 @@ void test_receive_mam_message(void) {
158
161
for (size_t count = 0 ; count < TEST_COUNT ; count ++ ) {
159
162
clock_gettime (CLOCK_REALTIME , & start_time );
160
163
TEST_ASSERT_FALSE (
161
- api_receive_mam_message (& service , BUNDLE_HASH , & json_result ));
164
+ api_receive_mam_message (& ta_core . service , BUNDLE_HASH , & json_result ));
162
165
clock_gettime (CLOCK_REALTIME , & end_time );
163
166
#if defined(ENABLE_STAT )
164
167
printf ("%lf\n" , diff_time (start_time , end_time ));
@@ -171,12 +174,8 @@ void test_receive_mam_message(void) {
171
174
172
175
int main (void ) {
173
176
UNITY_BEGIN ();
174
- service .http .path = "/" ;
175
- service .http .host = IRI_HOST ;
176
- service .http .port = IRI_PORT ;
177
- service .http .api_version = 1 ;
178
- service .serializer_type = SR_JSON ;
179
- iota_client_core_init (& service );
177
+
178
+ ta_config_init (& ta_core .info , & ta_core .config , & ta_core .service );
180
179
181
180
printf ("Total samples for each API test: %d\n" , TEST_COUNT );
182
181
RUN_TEST (test_generate_address );
@@ -187,6 +186,6 @@ int main(void) {
187
186
RUN_TEST (test_find_transactions_by_tag );
188
187
RUN_TEST (test_find_transactions_obj_by_tag );
189
188
RUN_TEST (test_receive_mam_message );
190
- iota_client_core_destroy ( & service );
189
+ ta_config_destroy ( & ta_core . service );
191
190
return UNITY_END ();
192
191
}
0 commit comments