Skip to content

Commit e35a20e

Browse files
committed
Improved formatting
1 parent d3ba56a commit e35a20e

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

test/indexing_and_creation_tests.jl

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ end
2424
#### End Setup
2525

2626

27-
cell1 = Cell([1.0;2.0;3.0])
28-
cell2 = Cell([4.0;5])
27+
cell1 = Cell([1.0; 2.0; 3.0])
28+
cell2 = Cell([4.0; 5])
2929

3030
sim_cell = similar(cell1)
3131

3232
@test length(cell1) == 3
33-
sim_cell.nodes[:] = [1.;2;3]
34-
@test sim_cell.nodes == cell1.nodes
35-
@test !(sim_cell.nodes === cell1.nodes)
33+
sim_cell.values[:] = [1.; 2; 3]
34+
@test sim_cell.values == cell1.values
35+
@test !(sim_cell.values === cell1.values)
3636

37-
cell3 = Cell([3.0;2.0;5.0])
38-
cell4 = Cell([4.0;6])
37+
cell3 = Cell([3.0; 2.0; 5.0])
38+
cell4 = Cell([4.0; 6])
3939

4040
@test cell4[2] == 6.0
4141

42-
p = construct(Population,deepcopy([cell1,cell2]))
42+
p = construct(Population, deepcopy([cell1, cell2]))
4343

4444
@test p[1] == 1
4545
@test p[2] == 2
@@ -48,17 +48,17 @@ p = construct(Population,deepcopy([cell1,cell2]))
4848
@test p[5] == 5
4949

5050
sim_p = similar(p)
51-
sim_p_arr = similar(p,indices(p))
51+
sim_p_arr = similar(p, indices(p))
5252

5353
@test typeof(sim_p) <: Population
5454
@test typeof(sim_p_arr) <: Vector{Float64}
5555
@test length(sim_p) == length(p)
5656
@test length(sim_p.nodes[1]) == length(p.nodes[1])
5757
@test !(sim_p.nodes[1] === p.nodes[1])
5858

59-
p2 = construct(Population,deepcopy([cell3,cell4]))
59+
p2 = construct(Population, deepcopy([cell3, cell4]))
6060

61-
tis = construct(Tissue,deepcopy([p,p2]))
61+
tis = construct(Tissue, deepcopy([p, p2]))
6262

6363
sim_tis = similar(tis)
6464
@test length(sim_tis) == length(tis)
@@ -69,11 +69,11 @@ sim_tis = similar(tis)
6969
@test tis.nodes[2].end_idxs[2] == length(cell1)+length(cell2)
7070
@test tis.nodes[2].end_idxs[2] == length(p)
7171

72-
tis2 = construct(Tissue,deepcopy([p2,p]))
72+
tis2 = construct(Tissue, deepcopy([p2, p]))
7373

74-
em = construct(Embryo,deepcopy([tis,tis2]))
74+
em = construct(Embryo, deepcopy([tis, tis2]))
7575

76-
tis3 = construct(Tissue,deepcopy([p,p2]))
76+
tis3 = construct(Tissue, deepcopy([p, p2]))
7777

7878
@test length(em) == 20
7979

@@ -122,11 +122,11 @@ end
122122

123123
### Test math
124124

125-
#broadcast_getindex(cell1,1)
125+
#broadcast_getindex(cell1, 1)
126126

127-
g = (x,y) -> x*y
128-
@test g.(cell1,2) == [2.;4;6]
129-
# cell1 .= g.(cell1,2) How to broadcast right???
127+
g = (x, y) -> x*y
128+
@test g.(cell1, 2) == [2.; 4; 6]
129+
# cell1 .= g.(cell1, 2) How to broadcast right???
130130

131131
cell3 = cell1 .+ 2
132132

@@ -145,37 +145,37 @@ p/zero(t)
145145

146146
size(p)
147147

148-
f = function (t,u,du)
148+
f = function (t, u, du)
149149
for i in eachindex(u)
150150
du[i] = 0.42*u[i]
151151
end
152152
end
153-
g = function (t,u,du)
153+
g = function (t, u, du)
154154
for i in eachindex(u)
155155
du[i] = 0.42*u[i]
156156
end
157157
end
158158

159-
vem = @view [em,em][1:2]
159+
vem = @view [em, em][1:2]
160160

161-
prob = ODEProblem(f,em,(0.0,1500.0))
162-
@time sol1 = solve(prob,Tsit5(),save_everystep=false)
161+
prob = ODEProblem(f, em, (0.0, 1500.0))
162+
@time sol1 = solve(prob, Tsit5(), save_everystep=false)
163163

164-
prob = ODEProblem(f,em[:],(0.0,1500.0))
165-
@time sol2 = solve(prob,Tsit5(),save_everystep=false)
164+
prob = ODEProblem(f, em[:], (0.0, 1500.0))
165+
@time sol2 = solve(prob, Tsit5(), save_everystep=false)
166166
@test sol1.t == sol2.t
167167

168-
prob = ODEProblem(f,em,(0.0,1500.0))
169-
sol1 = solve(prob,Tsit5())
168+
prob = ODEProblem(f, em, (0.0, 1500.0))
169+
sol1 = solve(prob, Tsit5())
170170

171171
# Check stepping behavior matches array
172172
srand(100)
173-
prob = SDEProblem(f,g,em,(0.0,1000.0))
174-
@time sol1 = solve(prob,SRIW1(),progress=false,abstol=1e-2,reltol=1e-2,save_everystep=false)
173+
prob = SDEProblem(f, g, em, (0.0, 1000.0))
174+
@time sol1 = solve(prob, SRIW1(), progress=false, abstol=1e-2, reltol=1e-2, save_everystep=false)
175175

176176
srand(100)
177-
prob = SDEProblem(f,g,em[:],(0.0,1000.0))
178-
@time sol2 = solve(prob,SRIW1(),progress=false,abstol=1e-2,reltol=1e-2,save_everystep=false)
177+
prob = SDEProblem(f, g, em[:], (0.0, 1000.0))
178+
@time sol2 = solve(prob, SRIW1(), progress=false, abstol=1e-2, reltol=1e-2, save_everystep=false)
179179
@test sol1.t == sol2.t
180180

181181
function test_loop(a)
@@ -189,18 +189,18 @@ end
189189
a = em[:]
190190
@time a[1]
191191

192-
#sol = solve(prob,EM())
192+
#sol = solve(prob, EM())
193193

194194
em2 = similar(em)
195-
recursivecopy!(em2,em)
195+
recursivecopy!(em2, em)
196196
@test em[5] == em2[5]
197197
@test em != em2
198198

199199
## Level iterators
200200

201201
em = em_save
202-
level_iter(em,1) == em.nodes
203-
for (i,p) in enumerate(level_iter(em,2))
202+
level_iter(em, 1) == em.nodes
203+
for (i, p) in enumerate(level_iter(em, 2))
204204
if i == 1
205205
@test p == em.nodes[1].nodes[1]
206206
elseif i == 2
@@ -220,21 +220,21 @@ end
220220

221221
em_arr = em[:]
222222

223-
for (x,y,z) in LevelIterIdx(em,1)
224-
@test maximum(em_arr[y:z]- x[:]) ==0
223+
for (x, y, z) in LevelIterIdx(em, 1)
224+
@test maximum(em_arr[y:z] - x[:]) == 0
225225
end
226226

227-
for (x,y,z) in LevelIterIdx(em,2)
228-
@test maximum(em_arr[y:z]- x[:]) ==0
227+
for (x, y, z) in LevelIterIdx(em, 2)
228+
@test maximum(em_arr[y:z] - x[:]) == 0
229229
end
230230

231-
for (x,y,z) in LevelIterIdx(em,3)
232-
@test maximum(em_arr[y:z]- x[:]) ==0
231+
for (x, y, z) in LevelIterIdx(em, 3)
232+
@test maximum(em_arr[y:z] - x[:]) == 0
233233
end
234234

235235
### Non-Empty y
236236

237-
p = construct(Population,deepcopy([cell1,cell2]),[1.;2;3])
237+
p = construct(Population, deepcopy([cell1, cell2]), [1.; 2; 3])
238238

239239
@test p[1] == 1
240240
@test p[2] == 2
@@ -250,9 +250,9 @@ sim_p = similar(p)
250250
@test length(sim_p.nodes[1]) == length(p.nodes[1])
251251
@test !(sim_p.nodes[1]===p.nodes[1])
252252

253-
p2 = construct(Population,deepcopy([cell3,cell4]),[11.;12;13])
253+
p2 = construct(Population, deepcopy([cell3, cell4]), [11.; 12; 13])
254254

255-
tis = construct(Tissue,deepcopy([p,p2]))
255+
tis = construct(Tissue, deepcopy([p, p2]))
256256

257257
@test length(tis) == length(p) + length(p2)
258258

0 commit comments

Comments
 (0)