|
13 | 13 | Ints←#.random.Ints |
14 | 14 | Chars←#.random.Chars |
15 | 15 | ⎕DIV←1 |
16 | | - |
| 16 | + ⎕IO←1 |
17 | 17 |
|
18 | 18 | ⍝ data |
19 | 19 | case←⍬ |
|
23 | 23 | data_i2←100 Ints 16 |
24 | 24 | data_i4←100 Ints 32 |
25 | 25 |
|
26 | | - ⍝ data_char0←⎕AV ⍝ 82: DyalogAPL classic char set |
27 | | - ⍝ :If ~#.utils.isClassic |
28 | | - ⍝ data_char1←100 Chars 8 ⍝ 80: 8 bits character |
29 | | - ⍝ data_char2←100 Chars 16 ⍝ 160: 16 bits character |
30 | | - ⍝ data_char3←100 Cha2rs 32 ⍝ 320: 32 bits character |
31 | | - ⍝ ⍝ data_char_ptr←data_char1 data_char2 data_char3⍝ 326: Pointer (32-bit or 64-bit as appropriate) |
32 | | - ⍝ :EndIf |
33 | 26 | ⍝ data_ptr←data_i1 data_i2 data_i4 ⍝ 326: Pointer (32-bit or 64-bit as appropriate) |
34 | 27 | data_dbl←{⍵,-⍵}data_i4+0.1 ⍝ 645: 64 bits Floating |
35 | 28 | data_cmplx←{⍵,-⍵}(0J1×⍳100)+⌽⍳100 ⍝ 1289: 128 bits Complex |
|
49 | 42 | data_Hfl←{⍵,-⍵}200000000000000000000000000000+(10000000000000000×⍳10) |
50 | 43 | ⎕FR←#.utils.fr_dbl |
51 | 44 |
|
| 45 | + caselist←⎕NL ¯2 |
| 46 | + caselist←caselist⌿⍨{'data_'⊃⍤⍷⍵}¨caselist |
52 | 47 | :For fr :In 1 2 |
53 | 48 | ⎕FR←fr⊃#.utils.(fr_dbl fr_decf) |
54 | | - ⎕IO←1 |
55 | 49 |
|
56 | | - ⍝ quadparams←⎕CT ⎕DCT ⎕FR ⎕IO ⎕DIV |
57 | | - caselist←⎕NL ¯2 |
58 | | - caselist←caselist⌿⍨{'data_'⊃⍤⍷⍵}¨caselist |
59 | 50 |
|
60 | 51 | :For f :In '+' '-' '×' '÷' ',' |
61 | 52 | :For case :In caselist |
|
77 | 68 | b←a←(?≢data)⊃data |
78 | 69 | c←(?≢data2)⊃data2 |
79 | 70 |
|
80 | | - ⍝ uses model to test modified assignment on all of the functions |
| 71 | + ⍝ uses model to test modified assignment on all of the functions |
81 | 72 | r,←('TCross1',f)desc Assert 3⊃(a(⍎f)←c ⋄ b←b(⍎f)model c ⋄ a≡b) |
82 | 73 | ⍝ array w scalar |
83 | 74 | b←a←data |
|
87 | 78 | data data2←data(#.utils.stripToSameLen)data2 |
88 | 79 | b←a←data |
89 | 80 | c←data2 |
90 | | - r,←('TCross2',f)desc Assert 3⊃(a(⍎f)←c ⋄ b←b(⍎f)model c ⋄ a≡b) |
| 81 | + r,←('TCross3',f)desc Assert 3⊃(a(⍎f)←c ⋄ b←b(⍎f)model c ⋄ a≡b) |
91 | 82 | :EndFor |
92 | 83 |
|
93 | 84 | ⍝ array w array of different shape and length - should error |
| 85 | + :If f≡',' |
| 86 | + :Continue |
| 87 | + :EndIf |
94 | 88 | len←(1+?≢data) |
95 | 89 | a←len↑data |
96 | 90 | c←(len+2)↑data |
97 | 91 |
|
98 | 92 | flag←0 ⍝ flag |
99 | 93 | :Trap 5 ⍝ 5: Length error |
100 | | - a+←c |
| 94 | + a(⍎f)←c |
101 | 95 | :Else |
102 | 96 | flag←1 |
103 | 97 | m←⎕DMX.Message |
|
106 | 100 | :EndFor |
107 | 101 | :EndFor |
108 | 102 | :EndFor |
| 103 | + |
| 104 | + ⍝ test character data separately as only , is allowed |
| 105 | + data_char0←⎕AV ⍝ 82: DyalogAPL classic char set |
| 106 | + :If ~#.utils.isClassic |
| 107 | + data_char1←100 Chars 8 ⍝ 80: 8 bits character |
| 108 | + data_char2←100 Chars 16 ⍝ 160: 16 bits character |
| 109 | + data_char3←100 Chars 32 ⍝ 320: 32 bits character |
| 110 | + ⍝ data_char_ptr←data_char1 data_char2 data_char3⍝ 326: Pointer (32-bit or 64-bit as appropriate) |
| 111 | + :EndIf |
| 112 | + |
| 113 | + caselist←⎕NL ¯2 |
| 114 | + caselist←caselist⌿⍨{'data_char'⊃⍤⍷⍵}¨caselist |
| 115 | + :For case :In caselist |
| 116 | + data←⍎case |
| 117 | + desc←testDesc |
| 118 | + b←a←(?≢data)⊃data |
| 119 | + c←(?≢data2)⊃data2 |
| 120 | + |
| 121 | + ⍝ scalars |
| 122 | + r,←('TCharCross1',f)desc Assert 3⊃(a,←c ⋄ b←b,model c ⋄ a≡b) |
| 123 | + |
| 124 | + ⍝ array w scalar |
| 125 | + b←a←data |
| 126 | + r,←('TCharCross2',f)desc Assert 3⊃(a,←c ⋄ b←b,model c ⋄ a≡b) |
| 127 | + |
| 128 | + ⍝ array w array of same length |
| 129 | + data data2←data(#.utils.stripToSameLen)data2 |
| 130 | + b←a←data |
| 131 | + c←data2 |
| 132 | + r,←('TCharCross3',f)desc Assert 3⊃(a,←c ⋄ b←b,model c ⋄ a≡b) |
| 133 | + |
| 134 | + ⍝ array w array of different shape and length - should error |
| 135 | + len←(1+?≢data) |
| 136 | + b←a←len↑data |
| 137 | + c←(len+2)↑data |
| 138 | + r,←('TCharCross4',f)desc Assert 3⊃(a,←c ⋄ b←b,model c ⋄ a≡b) |
| 139 | + :EndFor |
109 | 140 | ∇ |
110 | 141 | :EndNamespace |
0 commit comments