Skip to content

Commit

Permalink
add 2 missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Dec 14, 2022
1 parent 1d8e757 commit 9fd5a2e
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions unit-tests/rsutils/number/stabilized/test-stabilized.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@
#
#############################################################################################
#
test.start( "update stable value - nominal" )
#
# Verify if history is filled with a stable value and then filled with required percentage
# of new val, new val is returned as stable value.
#
test.start( "update stable value - nominal" )
#
try:
sv = stabilized_value( 10 )
sv.add( 55. )
Expand Down Expand Up @@ -216,5 +216,39 @@
test.unexpected_exception()
test.finish()
#
test.start( "update stable value - last stable not in history" )
try:
sv = stabilized_value( 10 )
sv.add( 55. )
test.check_equal( sv.get( 1. ), 55. );

sv.add( 60. )
sv.add( 60. )
sv.add( 60. )
sv.add( 60. )
sv.add( 60. )
sv.add( 60. )
sv.add( 60. )
sv.add( 60. )
sv.add( 60. )
test.check_equal( sv.get( 1. ), 55. )
test.check_equal( sv.get( 0.9 ), 60. )
sv.add( 70. )
test.check_equal( sv.get( 1. ), 60. )
except:
test.unexpected_exception()
test.finish()
#
test.start( "update stable value - last stable is in history" )
try:
sv = stabilized_value( 10 )
sv.add( 55. )
sv.add( 60. )
sv.add( 60. )
test.check_equal( sv.get( 0.8 ), 55. )
except:
test.unexpected_exception()
test.finish()
#
#############################################################################################
test.print_results_and_exit()

0 comments on commit 9fd5a2e

Please sign in to comment.