Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Sep 7, 2024
1 parent 4faee21 commit 243e370
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions usecases/cs/lpc/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@ func (s *CsLPCSuite) Test_PendingConsumptionLimits() {
func (s *CsLPCSuite) Test_Failsafe() {
limit, changeable, err := s.sut.FailsafeConsumptionActivePowerLimit()
assert.Equal(s.T(), 0.0, limit)
assert.Equal(s.T(), false, changeable)
assert.Equal(s.T(), true, changeable)
assert.Nil(s.T(), err)

err = s.sut.SetFailsafeConsumptionActivePowerLimit(10, true)
err = s.sut.SetFailsafeConsumptionActivePowerLimit(10, false)
assert.Nil(s.T(), err)

limit, changeable, err = s.sut.FailsafeConsumptionActivePowerLimit()
assert.Equal(s.T(), 10.0, limit)
assert.Equal(s.T(), true, changeable)
assert.Equal(s.T(), false, changeable)
assert.Nil(s.T(), err)

// The actual tests of the functionality is located in the util package
duration, changeable, err := s.sut.FailsafeDurationMinimum()
assert.Equal(s.T(), time.Duration(0), duration)
assert.Equal(s.T(), false, changeable)
assert.Equal(s.T(), true, changeable)
assert.Nil(s.T(), err)

err = s.sut.SetFailsafeDurationMinimum(time.Duration(time.Hour*1), true)
Expand All @@ -104,6 +104,9 @@ func (s *CsLPCSuite) Test_Failsafe() {
err = s.sut.SetFailsafeDurationMinimum(time.Duration(time.Hour*2), true)
assert.Nil(s.T(), err)

err = s.sut.SetFailsafeConsumptionActivePowerLimit(10, true)
assert.Nil(s.T(), err)

limit, changeable, err = s.sut.FailsafeConsumptionActivePowerLimit()
assert.Equal(s.T(), 10.0, limit)
assert.Equal(s.T(), true, changeable)
Expand Down
11 changes: 7 additions & 4 deletions usecases/cs/lpp/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ func (s *CsLPPSuite) Test_PendingProductionLimits() {
func (s *CsLPPSuite) Test_Failsafe() {
limit, changeable, err := s.sut.FailsafeProductionActivePowerLimit()
assert.Equal(s.T(), 0.0, limit)
assert.Equal(s.T(), false, changeable)
assert.Equal(s.T(), true, changeable)
assert.Nil(s.T(), err)

err = s.sut.SetFailsafeProductionActivePowerLimit(10, true)
err = s.sut.SetFailsafeProductionActivePowerLimit(10, false)
assert.Nil(s.T(), err)

limit, changeable, err = s.sut.FailsafeProductionActivePowerLimit()
assert.Equal(s.T(), 10.0, limit)
assert.Equal(s.T(), true, changeable)
assert.Equal(s.T(), false, changeable)
assert.Nil(s.T(), err)

// The actual tests of the functionality is located in the util package
duration, changeable, err := s.sut.FailsafeDurationMinimum()
assert.Equal(s.T(), time.Duration(0), duration)
assert.Equal(s.T(), false, changeable)
assert.Equal(s.T(), true, changeable)
assert.Nil(s.T(), err)

err = s.sut.SetFailsafeDurationMinimum(time.Duration(time.Hour*1), true)
Expand All @@ -103,6 +103,9 @@ func (s *CsLPPSuite) Test_Failsafe() {
err = s.sut.SetFailsafeDurationMinimum(time.Duration(time.Hour*2), true)
assert.Nil(s.T(), err)

err = s.sut.SetFailsafeProductionActivePowerLimit(10, true)
assert.Nil(s.T(), err)

limit, changeable, err = s.sut.FailsafeProductionActivePowerLimit()
assert.Equal(s.T(), 10.0, limit)
assert.Equal(s.T(), true, changeable)
Expand Down

0 comments on commit 243e370

Please sign in to comment.