Skip to content

Commit

Permalink
Move assertions.jl from Hecke (#1789)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Sep 17, 2024
1 parent ed58b14 commit ee8f572
Show file tree
Hide file tree
Showing 5 changed files with 674 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ makedocs(
],
"Miscellaneous" => [
"misc.md",
"assertions.md"
],
"Interfaces" => [
"interface_introduction.md",
Expand Down
62 changes: 62 additions & 0 deletions docs/src/assertions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Assertion and Verbosity Macros
```@meta
CurrentModule = AbstractAlgebra
DocTestSetup = quote
using AbstractAlgebra
end
```

We describe here various macros provided by AbstractAlgebra.

## Verbosity macros
There is a list of symbols called *verbosity scopes* which represent keywords used to
trigger some particular macros within the codes. Each of these verbosity scopes is
associated with a *verbosity level*, being set to $0$ by default. A verbosity macro
is joined to a verbosity scope `S` and a value `k` (set to $1$ by default) such that,
if the current verbosity level `l` of `S` is bigger than or equal to `k`, then the
macro triggers a given action.

```@docs
add_verbosity_scope(s::Symbol)
set_verbosity_level(s::Symbol, l::Int)
get_verbosity_level(s::Symbol)
```

### Printings

```@docs
@vprintln
@vprint
```

### Actions

```@docs
@v_do
```

## Assertion macros
There is a list of symbols called *assertion scopes* which represent keywords used to
trigger some particular macros within the codes. Each of these assertion scopes is
associated with an *assertion level*, being set to $0$ by default. An assertion macro
is joined to an assertion scope `S` and a value `k` (set to $1$ by default) such that,
if the current assertion level `l` of `S` is bigger than or equal to `k`, then the
macro triggers an action on the given assertion

```@docs
add_assertion_scope(s::Symbol)
set_assertion_level(s::Symbol, l::Int)
get_assertion_level(s::Symbol)
```

### Check

```@docs
@hassert
```

## Miscellaneous

```@docs
@req
```
1 change: 1 addition & 0 deletions src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ end
include("exports.jl")
include("AliasMacro.jl")
include("Aliases.jl") # needs to be included after AliasMacro.jl
include("Assertions.jl")

include("Attributes.jl")
include("PrintHelper.jl")
Expand Down
Loading

0 comments on commit ee8f572

Please sign in to comment.