|
1 | 1 | import _ctypes_test
|
| 2 | +import platform |
2 | 3 | import struct
|
3 | 4 | import sys
|
4 | 5 | import unittest
|
@@ -494,51 +495,6 @@ class Test3B(Test3A):
|
494 | 495 | ('more_data', c_float * 2),
|
495 | 496 | ]
|
496 | 497 |
|
497 |
| - class Test3C1(Structure): |
498 |
| - _fields_ = [ |
499 |
| - ("data", c_double * 4) |
500 |
| - ] |
501 |
| - |
502 |
| - class DataType4(Array): |
503 |
| - _type_ = c_double |
504 |
| - _length_ = 4 |
505 |
| - |
506 |
| - class Test3C2(Structure): |
507 |
| - _fields_ = [ |
508 |
| - ("data", DataType4) |
509 |
| - ] |
510 |
| - |
511 |
| - class Test3C3(Structure): |
512 |
| - _fields_ = [ |
513 |
| - ("x", c_double), |
514 |
| - ("y", c_double), |
515 |
| - ("z", c_double), |
516 |
| - ("t", c_double) |
517 |
| - ] |
518 |
| - |
519 |
| - class Test3D1(Structure): |
520 |
| - _fields_ = [ |
521 |
| - ("data", c_double * 5) |
522 |
| - ] |
523 |
| - |
524 |
| - class DataType5(Array): |
525 |
| - _type_ = c_double |
526 |
| - _length_ = 5 |
527 |
| - |
528 |
| - class Test3D2(Structure): |
529 |
| - _fields_ = [ |
530 |
| - ("data", DataType5) |
531 |
| - ] |
532 |
| - |
533 |
| - class Test3D3(Structure): |
534 |
| - _fields_ = [ |
535 |
| - ("x", c_double), |
536 |
| - ("y", c_double), |
537 |
| - ("z", c_double), |
538 |
| - ("t", c_double), |
539 |
| - ("u", c_double) |
540 |
| - ] |
541 |
| - |
542 | 498 | # Load the shared library
|
543 | 499 | dll = CDLL(_ctypes_test.__file__)
|
544 | 500 |
|
@@ -587,6 +543,58 @@ class Test3D3(Structure):
|
587 | 543 | self.assertAlmostEqual(s.more_data[0], -3.0, places=6)
|
588 | 544 | self.assertAlmostEqual(s.more_data[1], -2.0, places=6)
|
589 | 545 |
|
| 546 | + @unittest.skipIf( |
| 547 | + 'ppc64le' in platform.uname().machine, |
| 548 | + "gh-110190: currently fails on ppc64le", |
| 549 | + ) |
| 550 | + def test_array_in_struct_registers(self): |
| 551 | + dll = CDLL(_ctypes_test.__file__) |
| 552 | + |
| 553 | + class Test3C1(Structure): |
| 554 | + _fields_ = [ |
| 555 | + ("data", c_double * 4) |
| 556 | + ] |
| 557 | + |
| 558 | + class DataType4(Array): |
| 559 | + _type_ = c_double |
| 560 | + _length_ = 4 |
| 561 | + |
| 562 | + class Test3C2(Structure): |
| 563 | + _fields_ = [ |
| 564 | + ("data", DataType4) |
| 565 | + ] |
| 566 | + |
| 567 | + class Test3C3(Structure): |
| 568 | + _fields_ = [ |
| 569 | + ("x", c_double), |
| 570 | + ("y", c_double), |
| 571 | + ("z", c_double), |
| 572 | + ("t", c_double) |
| 573 | + ] |
| 574 | + |
| 575 | + class Test3D1(Structure): |
| 576 | + _fields_ = [ |
| 577 | + ("data", c_double * 5) |
| 578 | + ] |
| 579 | + |
| 580 | + class DataType5(Array): |
| 581 | + _type_ = c_double |
| 582 | + _length_ = 5 |
| 583 | + |
| 584 | + class Test3D2(Structure): |
| 585 | + _fields_ = [ |
| 586 | + ("data", DataType5) |
| 587 | + ] |
| 588 | + |
| 589 | + class Test3D3(Structure): |
| 590 | + _fields_ = [ |
| 591 | + ("x", c_double), |
| 592 | + ("y", c_double), |
| 593 | + ("z", c_double), |
| 594 | + ("t", c_double), |
| 595 | + ("u", c_double) |
| 596 | + ] |
| 597 | + |
590 | 598 | # Tests for struct Test3C
|
591 | 599 | expected = (1.0, 2.0, 3.0, 4.0)
|
592 | 600 | func = dll._testfunc_array_in_struct_set_defaults_3C
|
|
0 commit comments