1
1
module test_stdlib_bitset_large
2
2
use testdrive, only : new_unittest, unittest_type, error_type, check
3
3
use :: stdlib_kinds, only : int8, int16, int32, int64
4
- use stdlib_bitsets
4
+ use stdlib_bitsets, only: bitset_large, bits_kind&
5
+ , bits &
6
+ , success &
7
+ , and, and_not, or, xor&
8
+ , extract&
9
+ , assignment (= )&
10
+ , operator (<), operator (<= )&
11
+ , operator (>), operator (>= )&
12
+ , operator (/= ), operator (==)
5
13
implicit none
6
14
character (* ), parameter :: &
7
15
bitstring_0 = ' 000000000000000000000000000000000' , &
@@ -20,6 +28,7 @@ subroutine collect_stdlib_bitset_large(testsuite)
20
28
new_unittest(" string-operations" , test_string_operations), &
21
29
new_unittest(" io" , test_io), &
22
30
new_unittest(" initialization" , test_initialization), &
31
+ new_unittest(" bitset-assignment-array" , test_assignment_array), &
23
32
new_unittest(" bitset-inquiry" , test_bitset_inquiry), &
24
33
new_unittest(" bit-operations" , test_bit_operations), &
25
34
new_unittest(" bitset-comparisons" , test_bitset_comparisons), &
@@ -550,6 +559,36 @@ subroutine test_initialization(error)
550
559
551
560
end subroutine test_initialization
552
561
562
+ subroutine test_assignment_array (error )
563
+ ! > Error handling
564
+ type (error_type), allocatable , intent (out ) :: error
565
+
566
+ logical (int8) :: log1(64 ) = .true.
567
+
568
+ integer :: i
569
+ type (bitset_large) :: set1(0 :4 )
570
+
571
+ do i = 0 , size (set1) - 1
572
+ set1(i) = log1
573
+ enddo
574
+
575
+ do i = 0 , size (set1) - 1
576
+ call check(error, set1(i) % bits(), 64 , &
577
+ ' initialization with logical(int8) failed to set' // &
578
+ ' the right size in a bitset array.' )
579
+ if (allocated (error)) return
580
+ enddo
581
+
582
+ ! Test added following issue https://github.com/fortran-lang/stdlib/issues/726
583
+ set1(0 ) = set1(0 )
584
+
585
+ call check(error, set1(0 ) % bits(), 64 , &
586
+ ' initialization from bitset_large failed to set' // &
587
+ ' the right size in a bitset array.' )
588
+ if (allocated (error)) return
589
+
590
+ end subroutine test_assignment_array
591
+
553
592
subroutine test_bitset_inquiry (error )
554
593
! > Error handling
555
594
type (error_type), allocatable , intent (out ) :: error
0 commit comments