Skip to content

Commit af7a5a8

Browse files
committed
Add string marker tests
1 parent 0646a6f commit af7a5a8

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[deps]
22
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
3+
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
34
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/runtests.jl

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using XDF, Downloads, Test
1+
using XDF, Downloads, Test, SHA
22

33
@testset "Minimal XDF file" begin
44
url = "https://github.com/xdf-modules/example-files/blob/master/minimal.xdf?raw=true"
@@ -74,3 +74,37 @@ end
7474
@test d_stream["segments"][1] == (1, 12875)
7575
@test d_stream["segments"][2] == (12876, 27815)
7676
end
77+
78+
@testset "strings" begin
79+
file = "test/testdata/test_chunk3.xdf"
80+
@testset "strings.sha256" begin
81+
open(file) do f
82+
@test bytes2hex(sha256(f)) == "c730991efa078906117aa2accdca5f0ea11c54f43c3884770eba21e5a72edb82"
83+
end
84+
end
85+
@testset "strings.read_xdf" begin
86+
import XDF
87+
streams = XDF.read_xdf(file)
88+
end
89+
@testset "strings.dejitter" begin
90+
import XDF
91+
streams = XDF.read_xdf(file)
92+
s1 = streams[3735928559]
93+
@test s1["type"] == "Marker"
94+
@test s1["nchannels"] == 2
95+
@test s1["srate"] == 1000.0
96+
@test s1["dtype"] == String
97+
@test size(s1["data"]) == (1, 2)
98+
@test s1["data"] == ["Marker 0A" "Marker 0A"]
99+
s2 = streams[46202862]
100+
@test s2["type"] == "EEG"
101+
@test s2["nchannels"] == 64
102+
@test s2["srate"] == 1000.0
103+
@test s2["dtype"] == Float64
104+
@test size(s2["data"]) == (1, 64)
105+
@test sum(s2["data"]) == 0.0
106+
sgs = [XDF.dejitter(streams[k])["segments"] for k in keys(streams)]
107+
@test sgs[1] == [(1, 1)]
108+
@test sgs[2] == [(1, 1)]
109+
end
110+
end

test/testdata/test_chunk3.xdf

1.45 KB
Binary file not shown.

0 commit comments

Comments
 (0)