Skip to content

Commit 618b160

Browse files
committed
using Base.Test for tests.
1 parent cd5c90b commit 618b160

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/runtests.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
using LIBLINEAR
2+
using Base.Test
23

34
# computation validation
45
iris = readcsv(joinpath(dirname(@__FILE__), "iris.csv"))
56
labels = iris[:, 5]
67
instances = convert(Matrix{Float64}, iris[:, 1:4]')
8+
79
model = linear_train(labels[1:2:end], instances[:, 1:2:end]; verbose=true, solver_type=Cint(0))
810
gc()
911
(class, decvalues) = linear_predict(model, instances[:, 2:2:end], verbose=true)
1012
correct = Bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]
11-
@assert (class .== labels[2:2:end]) == correct
13+
@test (class .== labels[2:2:end]) == correct
1214
println("pass 1.")
1315

1416
model = linear_train(labels[1:2:end], sparse(instances[:, 1:2:end]); verbose=true, solver_type=Cint(0))
1517
gc()
1618
(class, decvalues) = linear_predict(model, sparse(instances[:, 2:2:end]), verbose=true)
1719
correct = Bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]
18-
@assert (class .== labels[2:2:end]) == correct
20+
@test (class .== labels[2:2:end]) == correct
1921
println("pass 2.")
20-
21-
# # test bias
22-
# model = linear_train(labels[1:2:end], instances[:, 1:2:end]; verbose=true, solver_type=Cint(0))
23-
# gc()

0 commit comments

Comments
 (0)