Skip to content

Commit 91e5628

Browse files
authored
add a few tests (#8)
* add a few tests * wrong index used * change var names and add one more test to parallel
1 parent d656abb commit 91e5628

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

test/transforms.jl

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,56 @@
223223
end
224224

225225
@testset "Sequential" begin
226-
# TODO
226+
x = rand(Normal(0,10), 1500)
227+
y = x + rand(Normal(0,2), 1500)
228+
z = y + rand(Normal(0,5), 1500)
229+
t = Table(; x, y, z)
230+
T = Scale(low=0.2, high=0.8) EigenAnalysis(:VDV)
231+
n, c = apply(T, t)
232+
tₒ = revert(T, n, c)
233+
@test Tables.matrix(t) Tables.matrix(tₒ)
234+
235+
x = rand(Normal(0,10), 1500)
236+
y = x + rand(Normal(0,2), 1500)
237+
z = y + rand(Normal(0,5), 1500)
238+
t = Table(; x, y, z)
239+
T = Select(:x, :z) ZScore() EigenAnalysis(:V) Scale(low=0, high=1)
240+
n, c = apply(T, t)
241+
tₒ = revert(T, n, c)
242+
@test Tables.matrix(t) Tables.matrix(tₒ)
227243
end
228244

229245
@testset "Parallel" begin
230-
# TODO
246+
x = rand(Normal(0,10), 1500)
247+
y = x + rand(Normal(0,2), 1500)
248+
z = y + rand(Normal(0,5), 1500)
249+
t = Table(; x, y, z)
250+
T = Scale(low=0.3, high=0.6) EigenAnalysis(:VDV)
251+
n, c = apply(T, t)
252+
tₒ = revert(T, n, c)
253+
@test Tables.matrix(t) Tables.matrix(tₒ)
254+
255+
# check cardinality of Parallel
256+
x = rand(Normal(0,10), 1500)
257+
y = x + rand(Normal(0,2), 1500)
258+
z = y + rand(Normal(0,5), 1500)
259+
t = Table(; x, y, z)
260+
T = ZScore() EigenAnalysis(:V)
261+
n = T(t)
262+
@test length(Tables.columnnames(n)) == 6
263+
264+
# distributivity with respect to Sequential
265+
x = rand(Normal(0,10), 1500)
266+
y = x + rand(Normal(0,2), 1500)
267+
z = y + rand(Normal(0,5), 1500)
268+
t = Table(; x, y, z)
269+
T₁ = Center()
270+
T₂ = Scale(low=0.2, high=0.8)
271+
T₃ = EigenAnalysis(:VD)
272+
P₁ = T₁ (T₂ T₃)
273+
P₂ = (T₁ T₂) (T₁ T₃)
274+
n₁ = P₁(t)
275+
n₂ = P₂(t)
276+
@test Tables.matrix(n₁) Tables.matrix(n₂)
231277
end
232278
end

0 commit comments

Comments
 (0)