This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree 1 file changed +30
-4
lines changed
1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change 89
89
Int[ mod (x, y), rem (x, y) ]
90
90
end
91
91
92
+ @acc function end_test (a)
93
+ a[3 : end ] .+ 1
94
+ end
95
+
96
+ function test6 ()
97
+ end_test ([1 ;2 ;3 ;4 ]) == [4 ;5 ]
98
+ end
99
+
100
+
92
101
@acc function end_test_numeric (a)
93
102
a[3 : 4 ] .+ 1
94
103
end
@@ -97,14 +106,25 @@ function test7()
97
106
end_test_numeric ([1 ;2 ;3 ;4 ]) == [4 ;5 ]
98
107
end
99
108
100
- @acc function end_test (a)
101
- a[3 : end ] .+ 1
109
+ @acc function accum1 ()
110
+ a = zeros (Int, 3 )
111
+ b = a
112
+ for i = 1 : 3
113
+ a += ones (Int, 3 )
114
+ end
115
+ a .+ b
102
116
end
103
117
104
- function test6 ()
105
- end_test ([1 ;2 ;3 ;4 ]) == [4 ;5 ]
118
+ @acc function accum2 ()
119
+ a = zeros (Int, 3 )
120
+ b = a
121
+ for i = 1 : 3
122
+ a .+ = ones (Int, 3 )
123
+ end
124
+ a .+ b
106
125
end
107
126
127
+
108
128
end
109
129
110
130
using Base. Test
@@ -120,5 +140,11 @@ println("Testing miscellaneous features...")
120
140
@test MiscTest. mod_rem_test (7 ,- 3 ) == [- 2 , 1 ]
121
141
@test MiscTest. mod_rem_test (- 7 ,3 ) == [2 , - 1 ]
122
142
@test MiscTest. mod_rem_test (- 7 ,- 3 ) == [- 1 , - 1 ]
143
+ @test MiscTest. accum1 () == [3 ,3 ,3 ]
144
+ if VERSION > v " 0.5.0-"
145
+ @test MiscTest. accum2 () == [6 ,6 ,6 ]
146
+ else
147
+ @test MiscTest. accum2 () == [3 ,3 ,3 ]
148
+ end
123
149
println (" Done testing miscellaneous features..." )
124
150
You can’t perform that action at this time.
0 commit comments