Skip to content

Commit 952c606

Browse files
author
Damian Rouson
authored
Merge pull request #22 from sourceryinstitute/fix-new-assert
Fix: update 'assert' reference in units utility
2 parents 6f4f990 + d56e500 commit 952c606

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/units_implementation.F90

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
! contract # NRC-HQ-60-17-C-0007
66
!
77
submodule(units_interface) units_implementation
8-
use assertions_interface, only : assertions,assert
8+
use assert_m, only : assert
99
implicit none
1010

1111
contains
@@ -79,7 +79,7 @@
7979
end procedure
8080

8181
module procedure real_power
82-
if (assertions) call assert(this%is_dimensionless(), &
82+
call assert(this%is_dimensionless(), &
8383
& "units%real_power: an entity raised to a real power must be dimensionless")
8484
!! Require dimensionless operand => result is default-initialized as dimensionless
8585
end procedure
@@ -90,38 +90,34 @@
9090
end procedure
9191

9292
module procedure add
93-
if (assertions) then
94-
!! Require consistent operand units
95-
associate(preconditions => [lhs%system==rhs%system, lhs%exponents_==rhs%exponents_] )
96-
call assert( all(preconditions), "units%add: consistent operands units")
97-
end associate
98-
end if
93+
!! Require consistent operand units
94+
associate(preconditions => [lhs%system==rhs%system, lhs%exponents_==rhs%exponents_] )
95+
call assert( all(preconditions), "units%add: consistent operands units")
96+
end associate
9997
total%exponents_ = lhs%exponents_
10098
total%system = lhs%system
10199
end procedure
102100

103101
module procedure subtract
104-
if (assertions) then
105-
!! Require consistent operand units
106-
associate(preconditions => [lhs%system==rhs%system, lhs%exponents_==rhs%exponents_] )
107-
call assert( all(preconditions), "units%subtract: consistent operand units")
108-
end associate
109-
end if
102+
!! Require consistent operand units
103+
associate(preconditions => [lhs%system==rhs%system, lhs%exponents_==rhs%exponents_] )
104+
call assert( all(preconditions), "units%subtract: consistent operand units")
105+
end associate
110106
difference%exponents_ = lhs%exponents_
111107
difference%system = lhs%system
112108
end procedure
113109

114110
module procedure multiply
115111

116-
if (assertions) call assert( lhs%system==rhs%system, "units%multiply: consistent operand units" )
112+
call assert( lhs%system==rhs%system, "units%multiply: consistent operand units" )
117113

118114
product_%exponents_ = lhs%exponents_ + rhs%exponents_
119115
product_%system = lhs%system
120116
end procedure
121117

122118
module procedure divide
123119

124-
if (assertions) call assert( numerator%system==denominator%system, "units%divide: consistent operand units" )
120+
call assert( numerator%system==denominator%system, "units%divide: consistent operand units" )
125121

126122
ratio%exponents_ = numerator%exponents_ - denominator%exponents_
127123
ratio%system = merge(numerator%system,dimensionless,any(ratio%exponents_/=0))

0 commit comments

Comments
 (0)