Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal/assertions #529

Merged
merged 11 commits into from
Aug 11, 2023
Merged

Internal/assertions #529

merged 11 commits into from
Aug 11, 2023

Conversation

SSoelvsten
Copy link
Owner

@SSoelvsten SSoelvsten commented Aug 10, 2023

Partly based on the need to clean up the assertion mess, as was evident in #527 .

  • Remove all adiar_assert(...) statements. Do one of the following two
    • Turn input-checks into an if-throw (+ unit tests)
    • Turn remaining internal checks into an adiar_debug(...).
  • Simplify adiar_invariant and adiar_precondition into a variadic adiar_debug.
  • Rename adiar_debug into adiar_assert.
  • Make adiar_assert throw an adiar::assert_errror instead of terminating.
  • Move adiar_unreachable() into its own header file.

This closes #422.

Some input validation checks are not consistent from an end-users perspective.

  • Remove the checks for bdd_from and zdd_from.

Most 'adiar_assert' into an if-throw statement for what is truly deemed checks
on the user's input. To this end, we introduce <adiar/exception.h> with aliases
of the std::exceptions. Later we can revisit these and change them into
something more appropriate.

Furthermore, all the debug-only macros have been combined into a simple
'adiar_debug' with variadic number of arguments.
This will make it much neater for unit testing, since it does not terminate on
the first violation.
@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Patch coverage: 97.586% and project coverage change: -0.032% ⚠️

Comparison is base (601adfd) 97.126% compared to head (386bd98) 97.094%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@              Coverage Diff              @@
##              main      #529       +/-   ##
=============================================
- Coverage   97.126%   97.094%   -0.032%     
=============================================
  Files           82        82               
  Lines         5637      5644        +7     
=============================================
+ Hits          5475      5480        +5     
- Misses         162       164        +2     
Files Changed Coverage Δ
src/adiar/bdd.h 100.000% <ø> (ø)
src/adiar/domain.h 100.000% <ø> (ø)
src/adiar/zdd.h 100.000% <ø> (ø)
src/adiar/zdd/expand.cpp 100.000% <ø> (ø)
src/adiar/internal/io/file.h 82.812% <57.143%> (-1.314%) ⬇️
src/adiar/internal/io/node_writer.h 99.363% <75.000%> (-0.637%) ⬇️
src/adiar/internal/io/levelized_file.h 98.246% <83.333%> (ø)
src/adiar/internal/algorithms/prod2.h 97.455% <91.667%> (ø)
src/adiar/adiar.cpp 93.103% <100.000%> (ø)
src/adiar/bdd/apply.cpp 100.000% <100.000%> (ø)
... and 43 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

Benchmark Report 🟢

origin/internal/assertions is an improvement of 0.87% (compared to origin/main).

Minimum running time (s) for 9-Queens:

origin/main origin/internal/assertions
0.27 0.27
Raw Data

Running times (s) for 9-Queens:

origin/main origin/internal/assertions
0.29 0.34
0.29 0.28
0.28 0.29
0.35 0.29
0.29 0.30
0.29 0.27
0.29 0.28
0.34 0.30
0.30 0.28
0.29 0.27
0.28 0.29
0.28 0.27
0.31 0.28
0.30 0.28
0.29 0.29
0.27 0.29

@github-actions
Copy link

Benchmark Report 🟢

origin/internal/assertions is an improvement of 1.79% (compared to origin/main).

Minimum running time (s) for 12-Queens:

origin/main origin/internal/assertions
12.86 12.63
Raw Data

Running times (s) for 12-Queens:

origin/main origin/internal/assertions
13.01 13.22
13.52 13.14
13.31 13.08
13.51 13.18
13.15 12.71
12.95 12.78
13.38 13.44
13.23 13.14
13.29 13.55
13.37 13.15
13.50 12.63
12.88 12.75
12.86 13.16
13.18 13.25
13.52 13.44
13.40 13.28

@github-actions
Copy link

Benchmark Report 🟢

origin/internal/assertions is an improvement of 2.53% (compared to origin/main).

Minimum running time (s) for 14-Queens:

origin/main origin/internal/assertions
538.30 524.68
Raw Data

Running times (s) for 14-Queens:

origin/main origin/internal/assertions
701.65 532.14
547.08 530.08
538.30 531.41
543.27 524.68

@github-actions
Copy link

Benchmark Report 🟢

origin/internal/assertions is a regression of 0.36% (compared to origin/main).

Minimum running time (s) for 9-Queens:

origin/main origin/internal/assertions
0.26 0.26
Raw Data

Running times (s) for 9-Queens:

origin/main origin/internal/assertions
0.27 0.26
0.26 0.27
0.27 0.26
0.27 0.26
0.26 0.26
0.26 0.27
0.26 0.32
0.26 0.26
0.26 0.26
0.26 0.26
0.32 0.26
0.26 0.27
0.26 0.27
0.26 0.26
0.26 0.26
0.33 0.34

@github-actions
Copy link

Benchmark Report 🟢

origin/internal/assertions is an improvement of 0.15% (compared to origin/main).

Minimum running time (s) for 14-Queens:

origin/main origin/internal/assertions
435.52 434.85
Raw Data

Running times (s) for 14-Queens:

origin/main origin/internal/assertions
577.54 435.05
438.29 437.35
435.52 434.85
438.72 436.20

@github-actions
Copy link

Benchmark Report 🟡

origin/internal/assertions is a regression of 2.62% (compared to origin/main).

Minimum running time (s) for 12-Queens:

origin/main origin/internal/assertions
17.04 17.49
Raw Data

Running times (s) for 12-Queens:

origin/main origin/internal/assertions
17.36 17.69
17.61 17.96
17.91 18.13
17.90 17.83
17.84 17.66
18.03 17.81
17.68 17.91
17.91 17.79
17.27 17.61
17.90 17.49
17.64 17.60
17.04 17.71
17.68 17.64
17.70 17.77
17.79 17.71
17.61 17.98

@SSoelvsten SSoelvsten merged commit f91a0d8 into main Aug 11, 2023
@SSoelvsten SSoelvsten deleted the internal/assertions branch August 11, 2023 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ code quality Uncle Bob would be proud
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Adiar assertion throw an exception rather than exit
1 participant