Skip to content

Commit bd8f09f

Browse files
committed
More tests
1 parent ae448dc commit bd8f09f

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

src/dataset.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ end
235235
# Dataset IO #
236236
#####################################################################################
237237
"""
238-
read_dataset(file, V::Type{Dataset{D, T}}, delim::Char = '\t'; skipstart = 0)
238+
read_dataset(file, ::Type{<:Dataset}, delim::Char = '\t'; skipstart = 0)
239239
Read a `delim`-delimited text file directly into a dataset of dimension `D`
240240
with numbers of type `T`.
241241

src/reconstruction.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ end
5050
Reconstruction(s::AbstractVector{T}, D, τ) where {T} =
5151
Reconstruction{D, T, τ}(reconstruct(s, Val{D}(), τ))
5252

53-
@inline Base.eltype(::Reconstruction{D, T, t}) where {T,D,t} = T
5453
@inline delay(::Reconstruction{D, T, t}) where {T,D,t} = t
5554

5655
function reconstruct_impl(::Type{Val{D}}) where D

test/dataset_tests.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ using Base.Test, StaticArrays
4444
@test dimension(data2) == 2
4545

4646
rm("test.txt")
47+
48+
write_dataset("test.txt", data, ',')
49+
@test isfile("test.txt")
50+
51+
data3 = read_dataset("test.txt", Dataset{3, Float64}, ',')
52+
@test dimension(data3) == 3
53+
@test data3 == data
54+
55+
data2 = read_dataset("test.txt", Dataset{2, Float64})
56+
@test dimension(data2) == 2
57+
58+
rm("test.txt")
59+
4760
@test !isfile("test.txt") # make extra sure!
4861
end
4962
end

test/reconstruction_tests.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
println("\nTesting Reconstruction")
2+
if current_module() != DynamicalSystemsBase
3+
using DynamicalSystemsBase
4+
end
5+
using Base.Test, StaticArrays
6+
7+
@testset "Reconstruction" begin
8+
ds = Systems.towel()
9+
data = trajectory(ds, 10000)
10+
s = data[:, 1]; N = length(s)
11+
@testset "D = $(D), τ = $(τ)" for D in [2,3], τ in [2,3]
12+
13+
R = Reconstruction(s, D, τ)
14+
15+
@test R[(1+τ):end, 1] == R[1:end-τ, 2]
16+
@test size(R) == (length(s) - τ*(D - 1), D)
17+
end
18+
end

0 commit comments

Comments
 (0)