From 51a4ed93ce71888b9f889e0173c909abaca20948 Mon Sep 17 00:00:00 2001 From: Jeff Fessler Date: Sat, 15 May 2021 04:56:39 -0400 Subject: [PATCH] [registry] AVS .fld data files (#333) --- src/registry.jl | 2 ++ test/files/avs-ascii.dat | 2 ++ test/files/avs-ascii.fld | 9 +++++++++ test/query.jl | 6 ++++++ 4 files changed, 19 insertions(+) create mode 100644 test/files/avs-ascii.dat create mode 100644 test/files/avs-ascii.fld diff --git a/src/registry.jl b/src/registry.jl index 737f0736..5b811f28 100644 --- a/src/registry.jl +++ b/src/registry.jl @@ -1,6 +1,7 @@ ### "Package registry" # Useful for packages that get used more than once below # Please alphabetize +const idAVSfldIO = :AVSfldIO => UUID("b6189060-daf9-4c28-845a-cc0984b81781") const idCSVFiles = :CSVFiles => UUID("5d742f6a-9f54-50ce-8119-2520741973ca") const idImageIO = :ImageIO => UUID("82e4d734-157c-48bb-816b-45c225c6df19") const idImageMagick = :ImageMagick => UUID("6218d12a-5da1-5696-b52f-db25d2ecc6d1") @@ -81,6 +82,7 @@ end add_format(format"RDataSingle", detect_rdata_single, [".rds"], [idRData, LOAD]) +add_format(format"AVSfld", "# AVS", [".fld"], [idAVSfldIO]) add_format(format"CSV", (), [".csv"], [idCSVFiles]) add_format(format"TSV", (), [".tsv"], [idCSVFiles]) add_format(format"Feather", "FEA1", [".feather"], [:FeatherFiles => UUID("b675d258-116a-5741-b937-b79f054b0542")]) diff --git a/test/files/avs-ascii.dat b/test/files/avs-ascii.dat new file mode 100644 index 00000000..2dffd80e --- /dev/null +++ b/test/files/avs-ascii.dat @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +7 8 9 8 7 6 diff --git a/test/files/avs-ascii.fld b/test/files/avs-ascii.fld new file mode 100644 index 00000000..38b3fb00 --- /dev/null +++ b/test/files/avs-ascii.fld @@ -0,0 +1,9 @@ +# AVS field file (ascii variant) +ndim=2 +dim1=3 +dim2=4 +nspace=2 +veclen=1 +data=int +field=uniform +variable 1 file=avs-ascii.dat filetype=ascii diff --git a/test/query.jl b/test/query.jl index 07c138f4..8a7d85ad 100644 --- a/test/query.jl +++ b/test/query.jl @@ -457,6 +457,12 @@ let file_dir = joinpath(@__DIR__, "files"), file_path = Path(file_dir) @test position(io) == 4 end end + + @testset "AVSfld detection" begin + q = query(joinpath(file_dir, "avs-ascii.fld")) + @test typeof(q) <: File{format"AVSfld"} + end + end @testset "Query from IOBuffer" begin