Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
CLASS ltc_fish_auction DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}fish_auction.
|
||||
METHODS setup.
|
||||
METHODS sums_and_counts FOR TESTING.
|
||||
METHODS ignores_invalid_entries FOR TESTING.
|
||||
METHODS normalizes_species FOR TESTING.
|
||||
METHODS result_is_sorted FOR TESTING.
|
||||
METHODS best_species_wins FOR TESTING.
|
||||
METHODS best_species_tie FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_fish_auction IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}fish_auction( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sums_and_counts.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 100 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 50 )
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 25 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 1 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'COD'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 175 ).
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-boat_count exp = 2 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_invalid_entries.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = ' ' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 0 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD normalizes_species.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = ' tuna' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'TUNA ' weight_kg = 20 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 1 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'TUNA'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 30 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD result_is_sorted.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'TUNA' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 10 ) ) ).
|
||||
|
||||
READ TABLE lt_result INTO DATA(ls_row) INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-species exp = 'COD' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species_wins.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_cut->best_species( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'TUNA' weight_kg = 40 ) ) )
|
||||
exp = 'TUNA' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species_tie.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_cut->best_species( VALUE #(
|
||||
( boat_id = 'B1' species = 'TUNA' weight_kg = 30 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 30 ) ) )
|
||||
exp = 'COD' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user