-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding some unit tests, also noting some todo locations to respond to…
… nick comments
- Loading branch information
1 parent
8e42478
commit a72282f
Showing
3 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package lifeloss | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/USACE/go-consequences/hazards" | ||
) | ||
|
||
func Test_RescDamUnanchoredWoodStability(t *testing.T) { | ||
|
||
sc := RescDamWoodUnanchored | ||
|
||
h := hazards.DepthandDVEvent{} | ||
h.SetDV(30) | ||
h.SetDepth(100) | ||
result := sc.Evaluate(h) | ||
if result != Stable { | ||
t.Fail() | ||
} | ||
|
||
h.SetDV(35) | ||
h.SetDepth(100) | ||
result = sc.Evaluate(h) | ||
if result != Collapsed { | ||
t.Fail() | ||
} | ||
} | ||
func Test_RescDamAnchoredWoodStability(t *testing.T) { | ||
|
||
sc := RescDamWoodAnchored | ||
|
||
h := hazards.DepthandDVEvent{} | ||
h.SetDV(35) | ||
h.SetDepth(100) | ||
result := sc.Evaluate(h) | ||
if result != Stable { | ||
t.Fail() | ||
} | ||
|
||
h.SetDV(75.4) | ||
h.SetDepth(100) | ||
result = sc.Evaluate(h) | ||
if result != Collapsed { | ||
t.Fail() | ||
} | ||
} | ||
func Test_RescDamConcreteMasonarySteelStability(t *testing.T) { | ||
|
||
sc := RescDamMasonryConcreteBrick | ||
|
||
h := hazards.DepthandDVEvent{} | ||
h.SetDV(35) | ||
h.SetDepth(100) | ||
result := sc.Evaluate(h) | ||
if result != Stable { | ||
t.Fail() | ||
} | ||
|
||
h.SetDV(75.4) | ||
h.SetDepth(10) | ||
result = sc.Evaluate(h) | ||
if result != Collapsed { | ||
t.Fail() | ||
} | ||
|
||
h.SetDV(75.4) | ||
h.SetDepth(20) | ||
result = sc.Evaluate(h) | ||
if result != Stable { //velocity is computed as not being high enough because depth was so high. | ||
t.Fail() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters