Skip to content

Commit

Permalink
save progress
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed May 22, 2024
1 parent 0ca7df1 commit 3a74ed6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/reactionsystem_serialisation/serialisation_support.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ end

# Gets the character at a specific index.
get_char(str, idx) = collect(str)[idx]
get_char_end(str, offset) = collect(str)[end - offset]
get_char_end(str, offset) = collect(str)[end+offset]

Check warning on line 26 in src/reactionsystem_serialisation/serialisation_support.jl

View check run for this annotation

Codecov / codecov/patch

src/reactionsystem_serialisation/serialisation_support.jl#L25-L26

Added lines #L25 - L26 were not covered by tests
# Gets a substring (which is robust to unicode characters like η).
get_substring(str, idx1, idx2) = String(collect(str)[idx1, idx2])
get_substring_end(str, idx1, offset) = String(collect(str)[idx1, end - offset])
get_substring(str, idx1, idx2) = String(collect(str)[idx1:idx2])
get_substring_end(str, idx1, offset) = String(collect(str)[idx1:end+offset])

Check warning on line 29 in src/reactionsystem_serialisation/serialisation_support.jl

View check run for this annotation

Codecov / codecov/patch

src/reactionsystem_serialisation/serialisation_support.jl#L28-L29

Added lines #L28 - L29 were not covered by tests


### Field Serialisation Support Functions ###
Expand Down Expand Up @@ -79,7 +79,7 @@ end
# any calls (e.g. X(t) becomes X). E.g. a species vector [X, Y, Z] is converted to "[X, Y, Z]".
function syms_2_strings(syms)
strip_called_syms = [strip_call(Symbolics.unwrap(sym)) for sym in syms]
return get_substring("$(convert(Vector{Any}, strip_called_syms))", 4)
return get_substring_end("$(convert(Vector{Any}, strip_called_syms))", 4, 0)

Check warning on line 82 in src/reactionsystem_serialisation/serialisation_support.jl

View check run for this annotation

Codecov / codecov/patch

src/reactionsystem_serialisation/serialisation_support.jl#L80-L82

Added lines #L80 - L82 were not covered by tests
end

# Converts a vector of symbolics (e.g. the species or parameter vectors) to a string corresponding to
Expand Down Expand Up @@ -127,7 +127,7 @@ function sym_2_declaration_string(sym; multiline_format = false)
for metadata in metadata_to_declare
@string_append! metadata_string metadata_2_string(sym, metadata) ", "
end
@string_append! dec_string $(get_substring_end(metadata_string, 1, -2)) "]"
@string_append! dec_string get_substring_end(metadata_string, 1, -2) "]"

Check warning on line 130 in src/reactionsystem_serialisation/serialisation_support.jl

View check run for this annotation

Codecov / codecov/patch

src/reactionsystem_serialisation/serialisation_support.jl#L124-L130

Added lines #L124 - L130 were not covered by tests
end

# Returns the declaration entry for the symbol.
Expand Down
2 changes: 1 addition & 1 deletion test/miscellaneous_tests/reactionsystem_serialisation.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Prepare Tests ###

# Fetch packages.
using Catalyst
using Catalyst, Test
using Catalyst: get_rxs
using ModelingToolkit: getdefault, getdescription, get_metadata

Expand Down

0 comments on commit 3a74ed6

Please sign in to comment.