Skip to content

Commit 0df04fd

Browse files
Fix viewfields backward compatibility and update test for new types
1 parent f9c141b commit 0df04fd

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/functions/viewfields.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ function viewfields(object::ScalesType002)
8686
return
8787
end
8888

89+
# Backward compatibility for ScalesType001
90+
function viewfields(object::ScalesType001)
91+
list_field = propertynames(object)
92+
93+
println()
94+
printstyled("[Mera]: Fields to scale from user/code units to selected units\n", bold=true, color=:normal)
95+
printstyled("=======================================================================\n", bold=true, color=:normal)
96+
for i=list_field
97+
#fname = fieldname(field, i)
98+
println(i, "\t= ", getfield(object, i)) #, "\t\t", "[",typeof(getfield(object, i)),"]")
99+
end
100+
println()
101+
return
102+
end
103+
89104

90105
function viewfields(object::PartInfoType)
91106

@@ -210,6 +225,22 @@ function viewfields(object::PhysicalUnitsType002)
210225
return
211226
end
212227

228+
# Backward compatibility for PhysicalUnitsType001
229+
function viewfields(object::PhysicalUnitsType001)
230+
231+
list_field = propertynames(object)
232+
233+
println()
234+
printstyled("[Mera]: Constants given in cgs units\n", bold=true, color=:normal)
235+
printstyled("=========================================\n", bold=true, color=:normal)
236+
for i=list_field
237+
println(i, "\t= ", getfield(object, i) )
238+
end
239+
240+
println()
241+
return
242+
end
243+
213244

214245
# todo: check
215246
function viewfields(object::DataSetType)

test/computational_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function run_computational_tests()
114114
constants = Mera.createconstants()
115115
@test_nowarn viewfields(constants)
116116

117-
scales = Mera.ScalesType001()
117+
scales = Mera.ScalesType002()
118118
scales.kpc = 1.0
119119
@test_nowarn viewfields(scales)
120120

0 commit comments

Comments
 (0)