1 #include <gtest/gtest.h>
2 
3 #include <math.h>
4 #include <fenv.h>
5 #include <float.h>
6 #include <limits.h>
7 #include <stdint.h>
8 #include <stdio.h>
9 
10 #include "include/complex.h"
11 
12 #define M_PI_2L 1.570796326794896619231321691639751442L
13 
14 using namespace testing::ext;
15 
16 class ComplexTest : public testing::Test {
17     void SetUp() override {}
18     void TearDown() override {}
19 };
20 
21 /**
22 * @tc.name: cabs_001
23 * @tc.desc: This test verifies whether the return value is 0 when both the real and imaginary parts of the passed
24             parameters are 0.
25 * @tc.type: FUNC
26 */
HWTEST_F(ComplexTest, cabs_001, TestSize.Level1)27 HWTEST_F(ComplexTest, cabs_001, TestSize.Level1)
28 {
29     double complex a = 0 + 0 * I;
30     EXPECT_EQ(0.0, cabs(a));
31 }
32 
33 /**
34 * @tc.name: cabsf_001
35 * @tc.desc: This test verifies whether the return value is 0 when both the real and imaginary parts of the passed
36             parameters are 0.
37 * @tc.type: FUNC
38 */
HWTEST_F(ComplexTest, cabsf_001, TestSize.Level1)39 HWTEST_F(ComplexTest, cabsf_001, TestSize.Level1)
40 {
41     float complex a = 0 + 0 * I;
42     EXPECT_EQ(0.0, cabsf(a));
43 }
44 
45 /**
46 * @tc.name: cabsl_001
47 * @tc.desc: This test verifies whether the return value is 0 when both the real and imaginary parts of the passed
48             parameters are 0.
49 * @tc.type: FUNC
50 */
HWTEST_F(ComplexTest, cabsl_001, TestSize.Level1)51 HWTEST_F(ComplexTest, cabsl_001, TestSize.Level1)
52 {
53     long double complex a = 0 + 0 * I;
54     EXPECT_EQ(0.0, cabsl(a));
55 }
56 
57 /**
58 * @tc.name: cacos_001
59 * @tc.desc: Test whether the cacos result is M_PI_2 when the parameter is 0.0.
60 * @tc.type: FUNC
61 */
HWTEST_F(ComplexTest, cacos_001, TestSize.Level1)62 HWTEST_F(ComplexTest, cacos_001, TestSize.Level1)
63 {
64     EXPECT_EQ(M_PI_2, cacos(0.0));
65 }
66 
67 /**
68 * @tc.name: cacosf_001
69 * @tc.desc: Test whether the cacosf result is M_PI_2 when the parameter is 0.0.
70 * @tc.type: FUNC
71 */
HWTEST_F(ComplexTest, cacosf_001, TestSize.Level1)72 HWTEST_F(ComplexTest, cacosf_001, TestSize.Level1)
73 {
74     EXPECT_EQ(static_cast<float>(M_PI_2), cacosf(0.0));
75 }
76 
77 /**
78 * @tc.name: cacosl_001
79 * @tc.desc: Test whether the cacosl result is M_PI_2L when the parameter is 0.0.
80 * @tc.type: FUNC
81 */
HWTEST_F(ComplexTest, cacosl_001, TestSize.Level1)82 HWTEST_F(ComplexTest, cacosl_001, TestSize.Level1)
83 {
84     EXPECT_EQ(M_PI_2L, cacosl(0.0));
85 }
86 
87 /**
88 * @tc.name: cacosh_001
89 * @tc.desc: Test whether the cacosh result is 0.0 when the parameter is 1.0.
90 * @tc.type: FUNC
91 */
HWTEST_F(ComplexTest, cacosh_001, TestSize.Level1)92 HWTEST_F(ComplexTest, cacosh_001, TestSize.Level1)
93 {
94     EXPECT_EQ(0.0, cacosh(1.0));
95 }
96 
97 /**
98 * @tc.name: cacoshl_001
99 * @tc.desc: Test whether the cacosh result is 0.0 when the parameter is 1.0.
100 * @tc.type: FUNC
101 */
HWTEST_F(ComplexTest, cacoshl_001, TestSize.Level1)102 HWTEST_F(ComplexTest, cacoshl_001, TestSize.Level1)
103 {
104     EXPECT_EQ(0.0, cacoshl(1.0));
105 }
106 
107 /**
108 * @tc.name: cacoshf_001
109 * @tc.desc: Test whether the cacosh result is 0.0 when the parameter is 1.0.
110 * @tc.type: FUNC
111 */
HWTEST_F(ComplexTest, cacoshf_001, TestSize.Level1)112 HWTEST_F(ComplexTest, cacoshf_001, TestSize.Level1)
113 {
114     EXPECT_EQ(0.0, cacoshf(1.0));
115 }
116 
117 /**
118 * @tc.name: carg_001
119 * @tc.desc: Test whether the carg result is 0.0 when the parameter is 0.
120 * @tc.type: FUNC
121 */
HWTEST_F(ComplexTest, carg_001, TestSize.Level1)122 HWTEST_F(ComplexTest, carg_001, TestSize.Level1)
123 {
124     EXPECT_EQ(0.0, carg(0));
125 }
126 
127 /**
128 * @tc.name: cargf_001
129 * @tc.desc: Test whether the cargf result is 0.0 when the parameter is 0.
130 * @tc.type: FUNC
131 */
HWTEST_F(ComplexTest, cargf_001, TestSize.Level1)132 HWTEST_F(ComplexTest, cargf_001, TestSize.Level1)
133 {
134     EXPECT_EQ(0.0, cargf(0));
135 }
136 
137 /**
138 * @tc.name: cargl_001
139 * @tc.desc: Test whether the cargl result is 0.0 when the parameter is 0.
140 * @tc.type: FUNC
141 */
HWTEST_F(ComplexTest, cargl_001, TestSize.Level1)142 HWTEST_F(ComplexTest, cargl_001, TestSize.Level1)
143 {
144     EXPECT_EQ(0.0, cargl(0));
145 }
146 
147 /**
148 * @tc.name: casin_001
149 * @tc.desc: Test whether the casin result is 0.0 when the parameter is 0.
150 * @tc.type: FUNC
151 */
HWTEST_F(ComplexTest, casin_001, TestSize.Level1)152 HWTEST_F(ComplexTest, casin_001, TestSize.Level1)
153 {
154     EXPECT_EQ(0.0, casin(0));
155 }
156 
157 /**
158 * @tc.name: casinf_001
159 * @tc.desc: Test whether the casinf result is 0.0 when the parameter is 0.
160 * @tc.type: FUNC
161 */
HWTEST_F(ComplexTest, casinf_001, TestSize.Level1)162 HWTEST_F(ComplexTest, casinf_001, TestSize.Level1)
163 {
164     EXPECT_EQ(0.0, casinf(0));
165 }
166 
167 /**
168 * @tc.name: casinl_001
169 * @tc.desc: Test whether the casinl result is 0.0 when the parameter is 0.
170 * @tc.type: FUNC
171 */
HWTEST_F(ComplexTest, casinl_001, TestSize.Level1)172 HWTEST_F(ComplexTest, casinl_001, TestSize.Level1)
173 {
174     EXPECT_EQ(0.0, casinl(0));
175 }
176 
177 /**
178 * @tc.name: casinh_001
179 * @tc.desc: Test whether the casinh result is 0.0 when the parameter is 0.
180 * @tc.type: FUNC
181 */
HWTEST_F(ComplexTest, casinh_001, TestSize.Level1)182 HWTEST_F(ComplexTest, casinh_001, TestSize.Level1)
183 {
184     EXPECT_EQ(0.0, casinh(0));
185 }
186 
187 /**
188 * @tc.name: casinhf_001
189 * @tc.desc: Test whether the casinhf result is 0.0 when the parameter is 0.
190 * @tc.type: FUNC
191 */
HWTEST_F(ComplexTest, casinhf_001, TestSize.Level1)192 HWTEST_F(ComplexTest, casinhf_001, TestSize.Level1)
193 {
194     EXPECT_EQ(0.0, casinhf(0));
195 }
196 
197 /**
198 * @tc.name: casinhl_001
199 * @tc.desc: Test whether the casin result is 0.0 when the parameter is 0.
200 * @tc.type: FUNC
201 */
HWTEST_F(ComplexTest, casinhl_001, TestSize.Level1)202 HWTEST_F(ComplexTest, casinhl_001, TestSize.Level1)
203 {
204     EXPECT_EQ(0.0, casinhl(0));
205 }
206 
207 /**
208 * @tc.name: catan_001
209 * @tc.desc: Test whether the catan result is 0.0 when the parameter is 0.
210 * @tc.type: FUNC
211 */
HWTEST_F(ComplexTest, catan_001, TestSize.Level1)212 HWTEST_F(ComplexTest, catan_001, TestSize.Level1)
213 {
214     EXPECT_EQ(0.0, catan(0));
215 }
216 
217 /**
218 * @tc.name: catanf_001
219 * @tc.desc: Test whether the catanf result is 0.0 when the parameter is 0.
220 * @tc.type: FUNC
221 */
HWTEST_F(ComplexTest, catanf_001, TestSize.Level1)222 HWTEST_F(ComplexTest, catanf_001, TestSize.Level1)
223 {
224     EXPECT_EQ(0.0, catanf(0));
225 }
226 
227 /**
228 * @tc.name: catanl_001
229 * @tc.desc: Test whether the catanl result is 0.0 when the parameter is 0.
230 * @tc.type: FUNC
231 */
HWTEST_F(ComplexTest, catanl_001, TestSize.Level1)232 HWTEST_F(ComplexTest, catanl_001, TestSize.Level1)
233 {
234     EXPECT_EQ(0.0, catanl(0));
235 }
236 
237 /**
238 * @tc.name: catanh_001
239 * @tc.desc: Test whether the catanh result is 0.0 when the parameter is 0.
240 * @tc.type: FUNC
241 */
HWTEST_F(ComplexTest, catanh_001, TestSize.Level1)242 HWTEST_F(ComplexTest, catanh_001, TestSize.Level1)
243 {
244     EXPECT_EQ(0.0, catanh(0));
245 }
246 
247 /**
248 * @tc.name: catanhf_001
249 * @tc.desc: Test whether the catanhf result is 0.0 when the parameter is 0.
250 * @tc.type: FUNC
251 */
HWTEST_F(ComplexTest, catanhf_001, TestSize.Level1)252 HWTEST_F(ComplexTest, catanhf_001, TestSize.Level1)
253 {
254     EXPECT_EQ(0.0, catanhf(0));
255 }
256 
257 /**
258 * @tc.name: catanhl_001
259 * @tc.desc: Test whether the catanhl result is 0.0 when the parameter is 0.
260 * @tc.type: FUNC
261 */
HWTEST_F(ComplexTest, catanhl_001, TestSize.Level1)262 HWTEST_F(ComplexTest, catanhl_001, TestSize.Level1)
263 {
264     EXPECT_EQ(0.0, catanhl(0));
265 }
266 
267 /**
268 * @tc.name: ccos_001
269 * @tc.desc: Test whether the ccos result is 1.0 when the parameter is 0.
270 * @tc.type: FUNC
271 */
HWTEST_F(ComplexTest, ccos_001, TestSize.Level1)272 HWTEST_F(ComplexTest, ccos_001, TestSize.Level1)
273 {
274     EXPECT_EQ(1.0, ccos(0));
275 }
276 
277 /**
278 * @tc.name: ccosf_001
279 * @tc.desc: Test whether the ccosf result is 1.0 when the parameter is 0.
280 * @tc.type: FUNC
281 */
HWTEST_F(ComplexTest, ccosf_001, TestSize.Level1)282 HWTEST_F(ComplexTest, ccosf_001, TestSize.Level1)
283 {
284     EXPECT_EQ(1.0, ccosf(0));
285 }
286 
287 /**
288 * @tc.name: ccosl_001
289 * @tc.desc: Test whether the ccosl result is 1.0 when the parameter is 0.
290 * @tc.type: FUNC
291 */
HWTEST_F(ComplexTest, ccosl_001, TestSize.Level1)292 HWTEST_F(ComplexTest, ccosl_001, TestSize.Level1)
293 {
294     EXPECT_EQ(1.0, ccosl(0));
295 }
296 
297 /**
298 * @tc.name: ccosh_001
299 * @tc.desc: Test whether the ccosh result is 1.0 when the parameter is 0.
300 * @tc.type: FUNC
301 */
HWTEST_F(ComplexTest, ccosh_001, TestSize.Level1)302 HWTEST_F(ComplexTest, ccosh_001, TestSize.Level1)
303 {
304     EXPECT_EQ(1.0, ccosh(0));
305 }
306 
307 /**
308 * @tc.name: ccoshf_001
309 * @tc.desc: Test whether the ccoshf result is 1.0 when the parameter is 0.
310 * @tc.type: FUNC
311 */
HWTEST_F(ComplexTest, ccoshf_001, TestSize.Level1)312 HWTEST_F(ComplexTest, ccoshf_001, TestSize.Level1)
313 {
314     EXPECT_EQ(1.0, ccoshf(0));
315 }
316 
317 /**
318 * @tc.name: ccoshl_001
319 * @tc.desc: Test whether the ccoshl result is 1.0 when the parameter is 0.
320 * @tc.type: FUNC
321 */
HWTEST_F(ComplexTest, ccoshl_001, TestSize.Level1)322 HWTEST_F(ComplexTest, ccoshl_001, TestSize.Level1)
323 {
324     EXPECT_EQ(1.0, ccoshl(0));
325 }
326 
327 /**
328 * @tc.name: cexp_001
329 * @tc.desc: Test whether the cexp result is 1.0 when the parameter is 0.
330 * @tc.type: FUNC
331 */
HWTEST_F(ComplexTest, cexp_001, TestSize.Level1)332 HWTEST_F(ComplexTest, cexp_001, TestSize.Level1)
333 {
334     EXPECT_EQ(1.0, cexp(0));
335 }
336 
337 /**
338 * @tc.name: cexpf_001
339 * @tc.desc: Test whether the cexpf result is 1.0 when the parameter is 0.
340 * @tc.type: FUNC
341 */
HWTEST_F(ComplexTest, cexpf_001, TestSize.Level1)342 HWTEST_F(ComplexTest, cexpf_001, TestSize.Level1)
343 {
344     EXPECT_EQ(1.0, cexpf(0));
345 }
346 
347 /**
348 * @tc.name: cexpl_001
349 * @tc.desc: Test whether the cexpl result is 1.0 when the parameter is 0.
350 * @tc.type: FUNC
351 */
HWTEST_F(ComplexTest, cexpl_001, TestSize.Level1)352 HWTEST_F(ComplexTest, cexpl_001, TestSize.Level1)
353 {
354     EXPECT_EQ(1.0, cexpl(0));
355 }
356 
357 /**
358 * @tc.name: cimag_001
359 * @tc.desc: Test whether the cimag result is 0.0 when the parameter is 0.
360 * @tc.type: FUNC
361 */
HWTEST_F(ComplexTest, cimag_001, TestSize.Level1)362 HWTEST_F(ComplexTest, cimag_001, TestSize.Level1)
363 {
364     EXPECT_EQ(0.0, cimag(0));
365 }
366 
367 /**
368 * @tc.name: cimagf_001
369 * @tc.desc: Test whether the cimagf result is 0.0f when the parameter is 0.
370 * @tc.type: FUNC
371 */
HWTEST_F(ComplexTest, cimagf_001, TestSize.Level1)372 HWTEST_F(ComplexTest, cimagf_001, TestSize.Level1)
373 {
374     EXPECT_EQ(0.0f, cimagf(0));
375 }
376 
377 /**
378 * @tc.name: cimagl_001
379 * @tc.desc: Test whether the cimagl result is 0.0 when the parameter is 0.
380 * @tc.type: FUNC
381 */
HWTEST_F(ComplexTest, cimagl_001, TestSize.Level1)382 HWTEST_F(ComplexTest, cimagl_001, TestSize.Level1)
383 {
384     EXPECT_EQ(0.0, cimagl(0));
385 }
386 
387 /**
388 * @tc.name: clog_001
389 * @tc.desc: Test whether the clog result is 0.0 when the parameter is 1.0.
390 * @tc.type: FUNC
391 */
HWTEST_F(ComplexTest, clog_001, TestSize.Level1)392 HWTEST_F(ComplexTest, clog_001, TestSize.Level1)
393 {
394     EXPECT_EQ(0.0, clog(1.0));
395 }
396 
397 /**
398 * @tc.name: clogf_001
399 * @tc.desc: Test whether the clogf result is 0.0f when the parameter is 1.0f.
400 * @tc.type: FUNC
401 */
HWTEST_F(ComplexTest, clogf_001, TestSize.Level1)402 HWTEST_F(ComplexTest, clogf_001, TestSize.Level1)
403 {
404     EXPECT_EQ(0.0f, clogf(1.0f));
405 }
406 
407 /**
408 * @tc.name: clogl_001
409 * @tc.desc: Test whether the clogl result is 0.0L when the parameter is 1.0L.
410 * @tc.type: FUNC
411 */
HWTEST_F(ComplexTest, clogl_001, TestSize.Level1)412 HWTEST_F(ComplexTest, clogl_001, TestSize.Level1)
413 {
414     EXPECT_EQ(0.0L, clogl(1.0L));
415 }
416 
417 /**
418 * @tc.name: conj_001
419 * @tc.desc: Test whether the conj result is 0.0 when the parameter is 0.
420 * @tc.type: FUNC
421 */
HWTEST_F(ComplexTest, conj_001, TestSize.Level1)422 HWTEST_F(ComplexTest, conj_001, TestSize.Level1)
423 {
424     EXPECT_EQ(0.0, conj(0));
425 }
426 
427 /**
428 * @tc.name: conjf_001
429 * @tc.desc: Test whether the conjf result is 0.0f when the parameter is 0.
430 * @tc.type: FUNC
431 */
HWTEST_F(ComplexTest, conjf_001, TestSize.Level1)432 HWTEST_F(ComplexTest, conjf_001, TestSize.Level1)
433 {
434     EXPECT_EQ(0.0f, conjf(0));
435 }
436 
437 /**
438 * @tc.name: conjl_001
439 * @tc.desc: Test whether the conjl result is 0.0 when the parameter is 0.
440 * @tc.type: FUNC
441 */
HWTEST_F(ComplexTest, conjl_001, TestSize.Level1)442 HWTEST_F(ComplexTest, conjl_001, TestSize.Level1)
443 {
444     EXPECT_EQ(0.0, conjl(0));
445 }
446 
447 /**
448 * @tc.name: cpowf_001
449 * @tc.desc: Test whether the cpowf result is 2.0f when the parameter is 3.0f.
450 * @tc.type: FUNC
451 */
HWTEST_F(ComplexTest, cpowf_001, TestSize.Level1)452 HWTEST_F(ComplexTest, cpowf_001, TestSize.Level1)
453 {
454     EXPECT_EQ(8.0f, cpowf(2.0f, 3.0f));
455 }
456 
457 /**
458 * @tc.name: cproj_001
459 * @tc.desc: Test whether the cproj result is 0.0 when the parameter is 0.
460 * @tc.type: FUNC
461 */
HWTEST_F(ComplexTest, cproj_001, TestSize.Level1)462 HWTEST_F(ComplexTest, cproj_001, TestSize.Level1)
463 {
464     EXPECT_EQ(0.0, cproj(0));
465 }
466 
467 /**
468 * @tc.name: cprojf_001
469 * @tc.desc: Test whether the cprojf result is 0.0f when the parameter is 0.
470 * @tc.type: FUNC
471 */
HWTEST_F(ComplexTest, cprojf_001, TestSize.Level1)472 HWTEST_F(ComplexTest, cprojf_001, TestSize.Level1)
473 {
474     EXPECT_EQ(0.0f, cprojf(0));
475 }
476 
477 /**
478 * @tc.name: cprojl_001
479 * @tc.desc: Test whether the cprojl result is 0.0 when the parameter is 0.
480 * @tc.type: FUNC
481 */
HWTEST_F(ComplexTest, cprojl_001, TestSize.Level1)482 HWTEST_F(ComplexTest, cprojl_001, TestSize.Level1)
483 {
484     EXPECT_EQ(0.0, cprojl(0));
485 }
486 
487 /**
488 * @tc.name: creal_001
489 * @tc.desc: Test whether the creal result is 2.0 when the parameter is 2.0 + 3.0I.
490 * @tc.type: FUNC
491 */
HWTEST_F(ComplexTest, creal_001, TestSize.Level1)492 HWTEST_F(ComplexTest, creal_001, TestSize.Level1)
493 {
494     EXPECT_EQ(2.0, creal(2.0 + 3.0I));
495 }
496 
497 /**
498 * @tc.name: crealf_001
499 * @tc.desc: Test whether the crealf result is 2.0f when the parameter is 2.0 + 3.0fI.
500 * @tc.type: FUNC
501 */
HWTEST_F(ComplexTest, crealf_001, TestSize.Level1)502 HWTEST_F(ComplexTest, crealf_001, TestSize.Level1)
503 {
504     EXPECT_EQ(2.0f, crealf(2.0f + 3.0fI));
505 }
506 
507 /**
508 * @tc.name: creall_001
509 * @tc.desc: Test whether the creall result is 2.0L when the parameter is 2.0 + 3.0LI.
510 * @tc.type: FUNC
511 */
HWTEST_F(ComplexTest, creall_001, TestSize.Level1)512 HWTEST_F(ComplexTest, creall_001, TestSize.Level1)
513 {
514     EXPECT_EQ(2.0, creall(2.0L + 3.0LI));
515 }
516 
517 /**
518 * @tc.name: csin_001
519 * @tc.desc: Test whether the csin result is 0.0 when the parameter is 0.
520 * @tc.type: FUNC
521 */
HWTEST_F(ComplexTest, csin_001, TestSize.Level1)522 HWTEST_F(ComplexTest, csin_001, TestSize.Level1)
523 {
524     EXPECT_EQ(0.0, csin(0));
525 }
526 
527 /**
528 * @tc.name: csinf_001
529 * @tc.desc: Test whether the csinf result is 0.0 when the parameter is 0.
530 * @tc.type: FUNC
531 */
HWTEST_F(ComplexTest, csinf_001, TestSize.Level1)532 HWTEST_F(ComplexTest, csinf_001, TestSize.Level1)
533 {
534     EXPECT_EQ(0.0, csinf(0));
535 }
536 
537 /**
538 * @tc.name: csinl_001
539 * @tc.desc: Test whether the csinl result is 0.0 when the parameter is 0.
540 * @tc.type: FUNC
541 */
HWTEST_F(ComplexTest, csinl_001, TestSize.Level1)542 HWTEST_F(ComplexTest, csinl_001, TestSize.Level1)
543 {
544     EXPECT_EQ(0.0, csinl(0));
545 }
546 
547 /**
548 * @tc.name: csinh_001
549 * @tc.desc: Test whether the csinh result is 0.0 when the parameter is 0.
550 * @tc.type: FUNC
551 */
HWTEST_F(ComplexTest, csinh_001, TestSize.Level1)552 HWTEST_F(ComplexTest, csinh_001, TestSize.Level1)
553 {
554     EXPECT_EQ(0.0, csinh(0));
555 }
556 
557 /**
558 * @tc.name: csinhf_001
559 * @tc.desc: Test whether the csinhf result is 0.0 when the parameter is 0.
560 * @tc.type: FUNC
561 */
HWTEST_F(ComplexTest, csinhf_001, TestSize.Level1)562 HWTEST_F(ComplexTest, csinhf_001, TestSize.Level1)
563 {
564     EXPECT_EQ(0.0, csinhf(0));
565 }
566 
567 /**
568 * @tc.name: csinhl_001
569 * @tc.desc: Test whether the csinhl result is 0.0 when the parameter is 0.
570 * @tc.type: FUNC
571 */
HWTEST_F(ComplexTest, csinhl_001, TestSize.Level1)572 HWTEST_F(ComplexTest, csinhl_001, TestSize.Level1)
573 {
574     EXPECT_EQ(0.0, csinhl(0));
575 }
576 
577 /**
578 * @tc.name: csqrt_001
579 * @tc.desc: Test whether the csqrt result is 0.0 when the parameter is 0.
580 * @tc.type: FUNC
581 */
HWTEST_F(ComplexTest, csqrt_001, TestSize.Level1)582 HWTEST_F(ComplexTest, csqrt_001, TestSize.Level1)
583 {
584     EXPECT_EQ(0.0, csqrt(0));
585 }
586 
587 /**
588 * @tc.name: csqrtf_001
589 * @tc.desc: Test whether the csqrtf result is 0.0 when the parameter is 0.
590 * @tc.type: FUNC
591 */
HWTEST_F(ComplexTest, csqrtf_001, TestSize.Level1)592 HWTEST_F(ComplexTest, csqrtf_001, TestSize.Level1)
593 {
594     EXPECT_EQ(0.0f, csqrtf(0));
595 }
596 
597 /**
598 * @tc.name: csqrtl_001
599 * @tc.desc: Test whether the csqrtl result is 0.0 when the parameter is 0.
600 * @tc.type: FUNC
601 */
HWTEST_F(ComplexTest, csqrtl_001, TestSize.Level1)602 HWTEST_F(ComplexTest, csqrtl_001, TestSize.Level1)
603 {
604     EXPECT_EQ(0.0, csqrtl(0));
605 }
606 
607 /**
608 * @tc.name: ctan_001
609 * @tc.desc: Test whether the ctan result is 0.0 when the parameter is 0.
610 * @tc.type: FUNC
611 */
HWTEST_F(ComplexTest, ctan_001, TestSize.Level1)612 HWTEST_F(ComplexTest, ctan_001, TestSize.Level1)
613 {
614     EXPECT_EQ(0.0, ctan(0));
615 }
616 
617 /**
618 * @tc.name: ctanf_001
619 * @tc.desc: Test whether the ctanf result is 0.0 when the parameter is 0.
620 * @tc.type: FUNC
621 */
HWTEST_F(ComplexTest, ctanf_001, TestSize.Level1)622 HWTEST_F(ComplexTest, ctanf_001, TestSize.Level1)
623 {
624     EXPECT_EQ(0.0, ctanf(0));
625 }
626 
627 /**
628 * @tc.name: ctanl_001
629 * @tc.desc: Test whether the ctanl result is 0.0 when the parameter is 0.
630 * @tc.type: FUNC
631 */
HWTEST_F(ComplexTest, ctanl_001, TestSize.Level1)632 HWTEST_F(ComplexTest, ctanl_001, TestSize.Level1)
633 {
634     EXPECT_EQ(0.0, ctanl(0));
635 }
636 
637 /**
638 * @tc.name: ctanh_001
639 * @tc.desc: When the input value is a valid value, test the return value of the function.
640 * @tc.type: FUNC
641 */
HWTEST_F(ComplexTest, ctanh_001, TestSize.Level1)642 HWTEST_F(ComplexTest, ctanh_001, TestSize.Level1)
643 {
644     EXPECT_TRUE(ctanh(0) == 0.0);
645 }
646 
647 /**
648 * @tc.name: ctanh_002
649 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
650             input, with the real part being NaN and the imaginary part being zero.
651 * @tc.type: FUNC
652 */
HWTEST_F(ComplexTest, ctanh_002, TestSize.Level1)653 HWTEST_F(ComplexTest, ctanh_002, TestSize.Level1)
654 {
655     double complex tan_result = ctanh(nan("") + 0i);
656     EXPECT_TRUE(isnan(creal(tan_result)));
657     EXPECT_TRUE(cimag(tan_result) == 0.0);
658 }
659 
660 /**
661 * @tc.name: ctanh_003
662 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
663             input, where both the real and imaginary parts are NaN.
664 * @tc.type: FUNC
665 */
HWTEST_F(ComplexTest, ctanh_003, TestSize.Level1)666 HWTEST_F(ComplexTest, ctanh_003, TestSize.Level1)
667 {
668     double complex tan_result = ctanh(nan("") + 2.0i);
669     EXPECT_TRUE(isnan(creal(tan_result)));
670     EXPECT_TRUE(isnan(cimag(tan_result)));
671 }
672 
673 /**
674 * @tc.name: ctanh_004
675 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
676             input, where both the real and imaginary parts are NaN.
677 * @tc.type: FUNC
678 */
HWTEST_F(ComplexTest, ctanh_004, TestSize.Level1)679 HWTEST_F(ComplexTest, ctanh_004, TestSize.Level1)
680 {
681     double complex tan_result = ctanh(nan("") + nan("") * I);
682     EXPECT_TRUE(isnan(creal(tan_result)));
683     EXPECT_TRUE(isnan(cimag(tan_result)));
684 }
685 
686 /**
687 * @tc.name: ctanhf_001
688 * @tc.desc: When the input value is a valid value, test the return value of the function.
689 * @tc.type: FUNC
690 */
HWTEST_F(ComplexTest, ctanhf_001, TestSize.Level1)691 HWTEST_F(ComplexTest, ctanhf_001, TestSize.Level1)
692 {
693     EXPECT_TRUE(ctanhf(0.0f) == 0.0f);
694 }
695 
696 /**
697 * @tc.name: ctanhf_002
698 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
699             input, with the real part being NaN and the imaginary part being zero.
700 * @tc.type: FUNC
701 */
HWTEST_F(ComplexTest, ctanhf_002, TestSize.Level1)702 HWTEST_F(ComplexTest, ctanhf_002, TestSize.Level1)
703 {
704     float complex tan_result = ctanhf(nanf("") + 0.0fi);
705     EXPECT_TRUE(isnan(crealf(tan_result)));
706     EXPECT_TRUE(cimagf(tan_result) == 0.0f);
707 }
708 
709 /**
710 * @tc.name: ctanhf_003
711 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
712             input, where both the real and imaginary parts are NaN.
713 * @tc.type: FUNC
714 */
HWTEST_F(ComplexTest, ctanhf_003, TestSize.Level1)715 HWTEST_F(ComplexTest, ctanhf_003, TestSize.Level1)
716 {
717     float complex tan_result = ctanhf(nanf("") + nanf("") * I);
718     EXPECT_TRUE(isnan(crealf(tan_result)));
719     EXPECT_TRUE(isnan(cimagf(tan_result)));
720 }
721 
722 /**
723 * @tc.name: ctanhf_004
724 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
725             input, where both the real and imaginary parts are NaN.
726 * @tc.type: FUNC
727 */
HWTEST_F(ComplexTest, ctanhf_004, TestSize.Level1)728 HWTEST_F(ComplexTest, ctanhf_004, TestSize.Level1)
729 {
730     float complex tan_result = ctanhf(nan("") + nan("") * I);
731     EXPECT_TRUE(isnan(creal(tan_result)));
732     EXPECT_TRUE(isnan(cimag(tan_result)));
733 }
734 
735 /**
736 * @tc.name: ctanhl_001
737 * @tc.desc: Test whether the ctanhl result is 0.0 when the parameter is 0,And test whether
738 *           the result is 0 when the virtual and real parts are not the same number.
739 * @tc.type: FUNC
740 */
HWTEST_F(ComplexTest, ctanhl_001, TestSize.Level1)741 HWTEST_F(ComplexTest, ctanhl_001, TestSize.Level1)
742 {
743     EXPECT_TRUE(ctanhl(0.0L) == 0.0L);
744 }
745 
746 /**
747 * @tc.name: ctanhl_002
748 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
749             input, with the real part being NaN and the imaginary part being zero.
750 * @tc.type: FUNC
751 */
HWTEST_F(ComplexTest, ctanhl_002, TestSize.Level1)752 HWTEST_F(ComplexTest, ctanhl_002, TestSize.Level1)
753 {
754     long double complex tan_result = ctanhl(nanl("") + 0.0Li);
755     EXPECT_TRUE(isnan(creall(tan_result)));
756 }
757 
758 /**
759 * @tc.name: ctanhl_003
760 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
761             input, where both the real and imaginary parts are NaN.
762 * @tc.type: FUNC
763 */
HWTEST_F(ComplexTest, ctanhl_003, TestSize.Level1)764 HWTEST_F(ComplexTest, ctanhl_003, TestSize.Level1)
765 {
766     long double complex tan_result = ctanhl(nanl("") + 2.0Li);
767     EXPECT_TRUE(isnan(creall(tan_result)));
768     EXPECT_TRUE(isnan(cimagl(tan_result)));
769 }
770 
771 /**
772 * @tc.name: ctanhl_004
773 * @tc.desc: This test verifies whether the ctanh function returns the expected result when processing a specific type of
774             input, where both the real and imaginary parts are NaN.
775 * @tc.type: FUNC
776 */
HWTEST_F(ComplexTest, ctanhl_004, TestSize.Level1)777 HWTEST_F(ComplexTest, ctanhl_004, TestSize.Level1)
778 {
779     long double complex tan_result = ctanhl(nanl("") + nanl("") * I);
780     EXPECT_TRUE(isnan(creall(tan_result)));
781     EXPECT_TRUE(isnan(cimagl(tan_result)));
782 }