Skip to content

Commit

Permalink
additional tests, minor bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cgroll committed May 14, 2015
1 parent 762d207 commit 9eb4547
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 25 deletions.
22 changes: 12 additions & 10 deletions src/Copulas.jl
Expand Up @@ -15,9 +15,7 @@ typealias IntArrays Array{Array{Int, 1}, 1}
####################

abstract Copula
abstract PccCop <: Copula
abstract PairCop <: PccCop
abstract VarPairCop <: PccCop
abstract PairCop <: Copula

# parametric pair copulas
abstract AbstractParamPC <: PairCop
Expand All @@ -27,12 +25,20 @@ abstract ParamPC_Cpp <: AbstractParamPC # VineCopulaCPP

# package code goes here
export # copula types
PairCop,
AbstractCTree,
AbstractParamPC,
Copula,
CTreeParRef,
CTreePaths,
MixPC,
ModPC,
PairCop,
ParamPC,
ParamPC_Cpp,
ModPC,
MixPC,
PCC,
PITMatrix,
Raw_html,
Vine,
# parametric copula types
IndepPC,
AMHPC,
Expand Down Expand Up @@ -76,10 +82,6 @@ Tawn2PC_Cpp,
TawnPC_Cpp,
tPC_Cpp,
# functions
PITMatrix,
Tree,
Vine,
Raw_html,
allPathVals,
allVals,
condSetChk,
Expand Down
4 changes: 2 additions & 2 deletions src/PCC/Vines/graphviz.jl
Expand Up @@ -111,9 +111,9 @@ function toGviz(tr::CTreeParRef,
write(stream, "}")
end

function toGviz(tr::AbstractCTree, stream::IO; args...)
function toGviz(tr::AbstractCTree, stream::IO, chrt::String; args...)
trPar = convert(CTreeParRef, tr)
return toGviz(trPar, stream; args...)
return toGviz(trPar, stream, chrt; args...)
end

function getCmd(tr::CTreeParRef, chrt::String)
Expand Down
4 changes: 0 additions & 4 deletions test/condTree_test.jl
Expand Up @@ -107,10 +107,6 @@ end
## attach! ##
#############

#############
## attach! ##
#############

## attach to end of path
tr = Copulas.CTreePaths(1, [2 3], [4])
Copulas.attach!(tr, 5, [2,3])
Expand Down
12 changes: 7 additions & 5 deletions test/graphviz_test.jl
Expand Up @@ -4,21 +4,23 @@ using Copulas
using Base.Test

tr = Copulas.CTreeParRef([0, 1, 2, 2])
Copulas.viz(tr)

expGraphvizString = """
digraph {
1 -> 2;
2 -> 3;
2 -> 4;
node [shape=circle];
edge [arrowhead=none];
1 -> 2 ;
2 -> 3 ;
2 -> 4 ;
}"""

@test expGraphvizString == Copulas.toGviz(tr)
@test expGraphvizString == Copulas.toConsole(tr)

tr = Copulas.CTreePaths(6, [4,2], [5,3,1], [5,7], [5,8], [5,9],
[5,10], [11], [12], [13], [14])

Copulas.viz(tr)
Copulas.viz(tr, cmd="neato")

Copulas.render(tr)
## Copulas.render(tr, "png", "/home/chris/treePic")
Expand Down
10 changes: 10 additions & 0 deletions test/pitmatrix_test.jl
Expand Up @@ -30,4 +30,14 @@ kk = PITMatrix([0.1 0.3;
0.4 -0.2;
0.6 0.4])

@test_throws Exception PITMatrix([0.1 0.3;
0.4 -0.2;
0.6 0.4])

kk = reshape([0.1 0.2;
0.4 0.3;
0.5 0.1], 3, 2, 1)

@test_throws Exception PITMatrix(kk)

end
8 changes: 4 additions & 4 deletions test/runtests.jl
Expand Up @@ -2,10 +2,10 @@ using Copulas
using Base.Test

tests = [
## "utils_test.jl",
## "paircop_test.jl",
## "condTree_test.jl",
## "graphviz_test.jl",
"utils_test.jl",
"paircop_test.jl",
"condTree_test.jl",
"graphviz_test.jl",
"vine_test.jl",
"rvine_matrix_test.jl",
"pcc_test.jl",
Expand Down
8 changes: 8 additions & 0 deletions test/rvine_matrix_test.jl
Expand Up @@ -33,6 +33,14 @@ kk = [2 0 0; 2 3 0; 3 2 2]
kk = [1 0 0; 2 3 0; 3 2 2]
@test Copulas.chkColumnSubsets(kk)

########
## dg ##
########

kk = [1 0 0; 2 3 0; 3 2 2]
rvm = Copulas.RVMatrix(kk)
@test Copulas.dg(rvm) == kk

###############
## allExcept ##
###############
Expand Down
11 changes: 11 additions & 0 deletions test/various_test.jl
@@ -0,0 +1,11 @@
module TestVarious

using Copulas
using Base.Test

## undefined testpcc
##------------------

@test_throws Exception Copulas.testpcc(187)

end

0 comments on commit 9eb4547

Please sign in to comment.