NREL-Sienna / InfrastructureSystems.jl

Utility package for Sienna's simulation infrastructure
https://nrel-sienna.github.io/InfrastructureSystems.jl/
BSD 3-Clause "New" or "Revised" License
39 stars 21 forks source link

Add assert_op macro #172

Closed daniel-thom closed 3 years ago

daniel-thom commented 3 years ago

This PR adds an assert macro that automatically prints the values that didn't match. A downside to this approach is that the Julia devs say that they plan to compile out assert statements in optimized builds. I don't know how they plan to do that. Use of this macro would not be covered by that.

codecov[bot] commented 3 years ago

Codecov Report

Merging #172 (0aba3d2) into master (b527f9e) will decrease coverage by 0.12%. The diff coverage is 67.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #172      +/-   ##
==========================================
- Coverage   70.35%   70.23%   -0.13%     
==========================================
  Files          41       42       +1     
  Lines        2601     2614      +13     
==========================================
+ Hits         1830     1836       +6     
- Misses        771      778       +7     
Flag Coverage Δ
unittests 70.23% <67.74%> (-0.13%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/InfrastructureSystems.jl 66.66% <ø> (ø)
src/deterministic.jl 78.57% <0.00%> (ø)
src/time_series_formats.jl 69.04% <0.00%> (ø)
src/validation.jl 9.90% <0.00%> (ø)
src/utils/assert_op.jl 44.44% <44.44%> (ø)
src/utils/utils.jl 52.40% <80.00%> (ø)
src/component.jl 85.92% <100.00%> (ø)
src/components.jl 90.21% <100.00%> (ø)
src/deterministic_single_time_series.jl 73.58% <100.00%> (ø)
src/forecasts.jl 84.37% <100.00%> (ø)
... and 3 more
daniel-thom commented 3 years ago

LGTM but it will be good to have a page in docs about it, if you can add it before merging would be great.

Sure. If Dheepak also approves then I will do that. I will also go through IS and PSY and apply this in cases where we are calling assert.