add test for edit/split
This commit is contained in:
parent
77769d040f
commit
39b5a334c7
3 changed files with 20 additions and 11 deletions
12
src/edit.jl
12
src/edit.jl
|
@ -1,17 +1,17 @@
|
|||
"""
|
||||
split_log(log::CoordLog, at::Unsigned, notes_1::AbstractString, notes_2::AbstractString)::Vector{CoordLog}
|
||||
|
||||
Split `log` at `at`, i.e. to `1:at` and `at:end` then assign `notes_1` and `notes_2` to notes for each other.
|
||||
Split `log` at `at`, i.e. to `1:at` and `(at + 1):end` then assign `notes_1` and `notes_2` to notes for each other.
|
||||
"""
|
||||
function split_log(log::CoordLog, at::Unsigned, notes_1::AbstractString, notes_2::AbstractString)::Vector{CoordLog}
|
||||
function split_log(log::CoordLog, at::Unsigned, notes_1::AbstractString, notes_2::AbstractString)::Tuple{CoordLog, CoordLog}
|
||||
@assert at < size(log.coords)[1] "Split index must be less than original log length($(size(log.coords)[1]))"
|
||||
[
|
||||
(
|
||||
CoordLog(log.coords[1:at, :], log.logdate, notes_1),
|
||||
CoordLog(log.coords[at:end, :], log.logdate, notes_2),
|
||||
]
|
||||
CoordLog(log.coords[(at + 1):end, :], log.logdate, notes_2),
|
||||
)
|
||||
end
|
||||
|
||||
function split_log(log::CoordLog, at::Integer, notes_1::AbstractString, notes_2::AbstractString)::Vector{CoordLog}
|
||||
function split_log(log::CoordLog, at::Integer, notes_1::AbstractString, notes_2::AbstractString)::Tuple{CoordLog, CoordLog}
|
||||
split_log(log, UInt(at), notes_1, notes_2)
|
||||
end
|
||||
|
||||
|
|
|
@ -85,8 +85,4 @@ function parse_log(filepaths::Vector{T}; interactive=false)::Vector{CoordLog} wh
|
|||
parse_log(filepath; interactive=interactive)
|
||||
end |> Iterators.flatten |> collect
|
||||
end
|
||||
CoordLog(
|
||||
[1.0 2.0 3.0; 4.0 5.0 6.0],
|
||||
Dates.now(),
|
||||
"a"
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue