-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_SeisBlock.jl
56 lines (44 loc) · 1.55 KB
/
test_SeisBlock.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Test SeisBlock type and methods
@testset "SeisBlock" begin
@testset "Constructor" begin
b = SeisBlock(rand(Float32,10,10))
@test b.fileheader.bfh.ns == 10
@test b.fileheader.bfh.DataSampleFormat == 5
vec_ = rand(Float32,10)
c = SeisBlock(vec_)
mat_ = reshape(vec_,10,1)
d = SeisBlock(mat_)
@test c.data == d.data
end
@testset "Methods" begin
b = SeisBlock(rand(Float32,10,10))
@test size(b) == (10,10)
end
@testset "set_traceheader" begin
b = SeisBlock(rand(Float32,10,10))
set_traceheader!(b.traceheaders, :SourceX, 102*ones(Int32, 10))
@test b.traceheaders[3].SourceX == 102
end
@testset "set_fileheader" begin
b = SeisBlock(rand(Float32,10,10))
set_fileheader!(b.fileheader.bfh, :ns, 12)
@test b.fileheader.bfh.ns == 12
end
@testset "set_header" begin
b = SeisBlock(rand(Float32,10,10))
set_header!(b, :ns, 12)
@test b.fileheader.bfh.ns == 12
@test b.traceheaders[1].ns == 12
set_header!(b, "ns", 13)
@test b.fileheader.bfh.ns == 13
@test b.traceheaders[1].ns == 13
set_header!(b, :SourceX, 12)
@test b.traceheaders[1].SourceX == 12
set_header!(b, "SourceY", 13)
@test b.traceheaders[1].SourceY == 13
set_header!(b, :GroupY, 14*ones(Int32, 10))
@test b.traceheaders[1].GroupY == 14
set_header!(b, "GroupX", 15*ones(Int32, 10))
@test b.traceheaders[1].GroupX == 15
end
end