Skip to content

Commit

Permalink
adding in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryGeorgist committed Apr 18, 2024
1 parent 1825c33 commit abd60e7
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions lifeloss/stability_test.go
Original file line number Diff line number Diff line change
@@ -1,72 +1,90 @@
package lifeloss
package lifeloss_test

import (
"fmt"
"testing"

"github.com/USACE/go-consequences/hazards"
"github.com/USACE/go-consequences/lifeloss"
)

func ExampleStabilityEvaluation() {

sc := lifeloss.RescDamWoodUnanchored

h := hazards.DepthandDVEvent{}
h.SetDV(30)
h.SetDepth(100)
result := sc.Evaluate(h)
fmt.Println(result)

h.SetDV(35)
h.SetDepth(100)
result = sc.Evaluate(h)
fmt.Println(result)
}

func Test_RescDamUnanchoredWoodStability(t *testing.T) {

sc := RescDamWoodUnanchored
sc := lifeloss.RescDamWoodUnanchored

h := hazards.DepthandDVEvent{}
h.SetDV(30)
h.SetDepth(100)
result := sc.Evaluate(h)
if result != Stable {
if result != lifeloss.Stable {
t.Fail()
}

h.SetDV(35)
h.SetDepth(100)
result = sc.Evaluate(h)
if result != Collapsed {
if result != lifeloss.Collapsed {
t.Fail()
}
}
func Test_RescDamAnchoredWoodStability(t *testing.T) {

sc := RescDamWoodAnchored
sc := lifeloss.RescDamWoodAnchored

h := hazards.DepthandDVEvent{}
h.SetDV(35)
h.SetDepth(100)
result := sc.Evaluate(h)
if result != Stable {
if result != lifeloss.Stable {
t.Fail()
}

h.SetDV(75.4)
h.SetDepth(100)
result = sc.Evaluate(h)
if result != Collapsed {
if result != lifeloss.Collapsed {
t.Fail()
}
}
func Test_RescDamConcreteMasonarySteelStability(t *testing.T) {

sc := RescDamMasonryConcreteBrick
sc := lifeloss.RescDamMasonryConcreteBrick

h := hazards.DepthandDVEvent{}
h.SetDV(35)
h.SetDepth(100)
result := sc.Evaluate(h)
if result != Stable {
if result != lifeloss.Stable {
t.Fail()
}

h.SetDV(75.4)
h.SetDepth(10)
result = sc.Evaluate(h)
if result != Collapsed {
if result != lifeloss.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.
if result != lifeloss.Stable { //velocity is computed as not being high enough because depth was so high.
t.Fail()
}
}

0 comments on commit abd60e7

Please sign in to comment.