Skip to content

Commit 740638d

Browse files
authored
More concrete Gadget2 format detector (#351)
1 parent e04d83d commit 740638d

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/registry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ function detect_gadget2(io)
473473
seek(io, sizeof(Int32)+256)
474474
temp2 = read(io, Int32)
475475
seek(io, pos)
476-
return temp1 == temp2
476+
return temp1 == temp2 == 256
477477
end
478478
add_format(format"Gadget2", detect_gadget2, [".gadget2", ".Gadget2", ".GADGET2"], [:AstroIO => UUID("c85a633c-0c3f-44a2-bffe-7f9d0681b3e7")])
479479

52 KB
Binary file not shown.

test/query.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,4 +549,9 @@ let file_dir = joinpath(@__DIR__, "files"), file_path = Path(file_dir)
549549
@test FileIO.unknown(q) # FIXME: should be RData
550550
@test FileIO.detect_rdata(io)
551551
end
552+
553+
@testset "Gadget2" begin
554+
q = query(joinpath(file_dir, "gassphere_littleendian.gadget2"))
555+
@test typeof(q) <: File{format"Gadget2"}
556+
end
552557
end

0 commit comments

Comments
 (0)