-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename package from MRC to MRCFile (#13)
* Rename package from MRC to MRCFile * Update e-mail address * Run formatter
- Loading branch information
Showing
12 changed files
with
78 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
using MRC | ||
using MRCFile | ||
using Documenter | ||
|
||
makedocs(; | ||
modules=[MRC], | ||
modules=[MRCFile], | ||
authors="Seth Axen <[email protected]> and contributors", | ||
sitename="MRC.jl", | ||
sitename="MRCFile.jl", | ||
format=Documenter.HTML(; | ||
prettyurls=get(ENV, "CI", "false") == "true", | ||
canonical="https://sethaxen.github.io/MRC.jl", | ||
canonical="https://sethaxen.github.io/MRCFile.jl", | ||
assets=String[], | ||
), | ||
pages=["Home" => "index.md", "API" => "api.md"], | ||
) | ||
|
||
deploydocs(; repo="github.com/sethaxen/MRC.jl") | ||
deploydocs(; repo="github.com/sethaxen/MRCFile.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# API | ||
|
||
```@autodocs | ||
Modules = [MRC] | ||
Modules = [MRCFile] | ||
Private = false | ||
Order = [:type, :function] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module MRC | ||
module MRCFile | ||
|
||
using Dates, Statistics, Mmap, CodecZlib, CodecBzip2, CodecXz, TranscodingStreams | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,89 @@ | ||
@testset "hostbyteorder" begin | ||
if Base.ENDIAN_BOM == 0x04030201 | ||
@test MRC.hostbyteorder() == MRC.LittleEndian | ||
@test MRCFile.hostbyteorder() == MRCFile.LittleEndian | ||
else | ||
@test MRC.hostbyteorder() == MRC.BigEndian | ||
@test MRCFile.hostbyteorder() == MRCFile.BigEndian | ||
end | ||
end | ||
|
||
@testset "machstfrombyteorder" begin | ||
@test MRC.machstfrombyteorder() == [0x44, 0x44, 0x00, 0x00] | ||
@test MRC.machstfrombyteorder(MRC.LittleEndian) == [0x44, 0x44, 0x00, 0x00] | ||
@test MRC.machstfrombyteorder(MRC.BigEndian) == [0x11, 0x11, 0x00, 0x00] | ||
@test MRCFile.machstfrombyteorder() == [0x44, 0x44, 0x00, 0x00] | ||
@test MRCFile.machstfrombyteorder(MRCFile.LittleEndian) == [0x44, 0x44, 0x00, 0x00] | ||
@test MRCFile.machstfrombyteorder(MRCFile.BigEndian) == [0x11, 0x11, 0x00, 0x00] | ||
end | ||
|
||
@testset "byteorderfrommachst" begin | ||
@test MRC.byteorderfrommachst([0x44, 0x44, 0x00, 0x00]) == MRC.LittleEndian | ||
@test MRC.byteorderfrommachst([0x44, 0x41, 0x00, 0x00]) == MRC.LittleEndian | ||
@test MRC.byteorderfrommachst([0x11, 0x11, 0x00, 0x00]) == MRC.BigEndian | ||
@test MRCFile.byteorderfrommachst([0x44, 0x44, 0x00, 0x00]) == MRCFile.LittleEndian | ||
@test MRCFile.byteorderfrommachst([0x44, 0x41, 0x00, 0x00]) == MRCFile.LittleEndian | ||
@test MRCFile.byteorderfrommachst([0x11, 0x11, 0x00, 0x00]) == MRCFile.BigEndian | ||
@test (@test_logs ( | ||
:warn, | ||
"Unrecognized machine stamp $([0x00, 0x00, 0x00, 0x00]). Assuming little endian.", | ||
) MRC.byteorderfrommachst([0x00, 0x00, 0x00, 0x00])) == MRC.LittleEndian | ||
) MRCFile.byteorderfrommachst([0x00, 0x00, 0x00, 0x00])) == MRCFile.LittleEndian | ||
end | ||
|
||
@testset "bswaptoh" begin | ||
@test MRC.bswaptoh(MRC.LittleEndian) == MRC.maybeswap(ltoh) | ||
@test MRC.bswaptoh(MRC.MACHINE_STAMP_LITTLE) == MRC.maybeswap(ltoh) | ||
@test MRC.bswaptoh(MRC.MACHINE_STAMP_LITTLE_ALT) == MRC.maybeswap(ltoh) | ||
@test MRC.bswaptoh(MRC.BigEndian) == MRC.maybeswap(ntoh) | ||
@test MRC.bswaptoh(MRC.MACHINE_STAMP_BIG) == MRC.maybeswap(ntoh) | ||
@test MRCFile.bswaptoh(MRCFile.LittleEndian) == MRCFile.maybeswap(ltoh) | ||
@test MRCFile.bswaptoh(MRCFile.MACHINE_STAMP_LITTLE) == MRCFile.maybeswap(ltoh) | ||
@test MRCFile.bswaptoh(MRCFile.MACHINE_STAMP_LITTLE_ALT) == MRCFile.maybeswap(ltoh) | ||
@test MRCFile.bswaptoh(MRCFile.BigEndian) == MRCFile.maybeswap(ntoh) | ||
@test MRCFile.bswaptoh(MRCFile.MACHINE_STAMP_BIG) == MRCFile.maybeswap(ntoh) | ||
end | ||
|
||
@testset "bswapfromh" begin | ||
@test MRC.bswapfromh(MRC.LittleEndian) == MRC.maybeswap(htol) | ||
@test MRC.bswapfromh(MRC.MACHINE_STAMP_LITTLE) == MRC.maybeswap(htol) | ||
@test MRC.bswapfromh(MRC.MACHINE_STAMP_LITTLE_ALT) == MRC.maybeswap(htol) | ||
@test MRC.bswapfromh(MRC.BigEndian) == MRC.maybeswap(hton) | ||
@test MRC.bswapfromh(MRC.MACHINE_STAMP_BIG) == MRC.maybeswap(hton) | ||
@test MRCFile.bswapfromh(MRCFile.LittleEndian) == MRCFile.maybeswap(htol) | ||
@test MRCFile.bswapfromh(MRCFile.MACHINE_STAMP_LITTLE) == MRCFile.maybeswap(htol) | ||
@test MRCFile.bswapfromh(MRCFile.MACHINE_STAMP_LITTLE_ALT) == MRCFile.maybeswap(htol) | ||
@test MRCFile.bswapfromh(MRCFile.BigEndian) == MRCFile.maybeswap(hton) | ||
@test MRCFile.bswapfromh(MRCFile.MACHINE_STAMP_BIG) == MRCFile.maybeswap(hton) | ||
end | ||
|
||
@testset "maybeswap" begin | ||
@test MRC.maybeswap(bswap, Int32(5)) === bswap(Int32(5)) | ||
@test MRC.maybeswap(bswap, "foo") === "foo" | ||
@test MRC.maybeswap(bswap, (Int32(5), Int32(6))) === (bswap(Int32(5)), bswap(Int32(6))) | ||
@test MRC.maybeswap(bswap, (0x01, 0x02)) === (0x01, 0x02) | ||
@test MRC.maybeswap(bswap)(Int32(5)) === bswap(Int32(5)) | ||
@test MRCFile.maybeswap(bswap, Int32(5)) === bswap(Int32(5)) | ||
@test MRCFile.maybeswap(bswap, "foo") === "foo" | ||
@test MRCFile.maybeswap(bswap, (Int32(5), Int32(6))) === | ||
(bswap(Int32(5)), bswap(Int32(6))) | ||
@test MRCFile.maybeswap(bswap, (0x01, 0x02)) === (0x01, 0x02) | ||
@test MRCFile.maybeswap(bswap)(Int32(5)) === bswap(Int32(5)) | ||
end | ||
|
||
@testset "padtruncto!" begin | ||
x = [1, 2, 3] | ||
MRC.padtruncto!(x, 4) | ||
MRCFile.padtruncto!(x, 4) | ||
@test x == [1, 2, 3, 0] | ||
MRC.padtruncto!(x, 6; value=1) | ||
MRCFile.padtruncto!(x, 6; value=1) | ||
@test x == [1, 2, 3, 0, 1, 1] | ||
MRC.padtruncto!(x, 3) | ||
MRCFile.padtruncto!(x, 3) | ||
@test x == [1, 2, 3] | ||
MRC.padtruncto!(x, 5; value=1.0) | ||
MRCFile.padtruncto!(x, 5; value=1.0) | ||
@test x == [1, 2, 3, 1, 1] | ||
end | ||
|
||
@testset "compression: $type" for type in keys(MRC.COMPRESSIONS) | ||
spec = getproperty(MRC.COMPRESSIONS, type) | ||
@testset "compression: $type" for type in keys(MRCFile.COMPRESSIONS) | ||
spec = getproperty(MRCFile.COMPRESSIONS, type) | ||
@testset "checkmagic" begin | ||
io = IOBuffer() | ||
write(io, spec.magic) | ||
write(io, [0x01, 0x02, 0x03]) | ||
seek(io, 0) | ||
type2 = MRC.checkmagic(io) | ||
type2 = MRCFile.checkmagic(io) | ||
@test type2 == type | ||
close(io) | ||
end | ||
|
||
@testset "checkextension" begin | ||
fn = "map.mrc$(spec.extension)" | ||
type2 = MRC.checkextension(fn) | ||
type2 = MRCFile.checkextension(fn) | ||
@test type2 == type | ||
end | ||
|
||
@testset "(de)compressstream" begin | ||
buf = IOBuffer() | ||
stream = MRC.compressstream(buf, type) | ||
stream = MRCFile.compressstream(buf, type) | ||
write(stream, b"foo", TranscodingStreams.TOKEN_END) | ||
newbuf = IOBuffer(take!(buf)) | ||
@test MRC.checkmagic(newbuf) == type | ||
newstream = MRC.decompressstream(newbuf, type) | ||
@test MRCFile.checkmagic(newbuf) == type | ||
newstream = MRCFile.decompressstream(newbuf, type) | ||
@test read(newstream) == b"foo" | ||
end | ||
end |
4ad974c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
4ad974c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/76082
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: