Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
152
tasks_gen/eval/G0189/hidden/duty_hidden.clas.abap
Normal file
152
tasks_gen/eval/G0189/hidden/duty_hidden.clas.abap
Normal file
@@ -0,0 +1,152 @@
|
||||
CLASS {{p}}duty_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING
|
||||
iv_value TYPE decfloat34
|
||||
iv_country TYPE string
|
||||
iv_category TYPE string
|
||||
EXPORTING
|
||||
ev_rate TYPE decfloat34
|
||||
ev_duty TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS food_rate FOR TESTING.
|
||||
METHODS textile_rate FOR TESTING.
|
||||
METHODS machine_rate FOR TESTING.
|
||||
METHODS unknown_category FOR TESTING.
|
||||
METHODS rounds_half_up FOR TESTING.
|
||||
METHODS minimum_duty FOR TESTING.
|
||||
METHODS zero_value FOR TESTING.
|
||||
METHODS pref_no_minimum FOR TESTING.
|
||||
METHODS pref_ch_de FOR TESTING.
|
||||
METHODS pref_fr_it_es FOR TESTING.
|
||||
METHODS negative_value FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}duty_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
CALL FUNCTION '{{P}}CUSTOMS_DUTY_OLD'
|
||||
EXPORTING
|
||||
iv_value = iv_value
|
||||
iv_country = iv_country
|
||||
iv_category = iv_category
|
||||
IMPORTING
|
||||
ev_rate = ev_rate
|
||||
ev_duty = ev_duty
|
||||
EXCEPTIONS
|
||||
invalid_value = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD food_rate.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = 1000 iv_country = 'US' iv_category = 'FOOD'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 50 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD textile_rate.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = '250.50' iv_country = 'US' iv_category = 'TEXTILE'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 12 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '30.06' ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD machine_rate.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = 2000 iv_country = 'US' iv_category = 'MACHINE'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 3 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 60 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_category.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = 1000 iv_country = 'US' iv_category = 'TOY'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounds_half_up.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = '123.7' iv_country = 'US' iv_category = 'FOOD'
|
||||
IMPORTING ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '6.19' ) act = lv_duty ).
|
||||
|
||||
call( EXPORTING iv_value = '123.45' iv_country = 'US' iv_category = 'FOOD'
|
||||
IMPORTING ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '6.17' ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_duty.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = 50 iv_country = 'US' iv_category = 'FOOD'
|
||||
IMPORTING ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_value.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
call( EXPORTING iv_value = 0 iv_country = 'US' iv_category = 'FOOD'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD pref_no_minimum.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = 10000 iv_country = 'CH' iv_category = 'TEXTILE'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD pref_ch_de.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = 10000 iv_country = 'DE' iv_category = 'MACHINE'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD pref_fr_it_es.
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
call( EXPORTING iv_value = 10000 iv_country = 'FR' iv_category = 'FOOD'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ).
|
||||
|
||||
call( EXPORTING iv_value = 10000 iv_country = 'IT' iv_category = 'FOOD'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ).
|
||||
|
||||
call( EXPORTING iv_value = 10000 iv_country = 'ES' iv_category = 'FOOD'
|
||||
IMPORTING ev_rate = lv_rate ev_duty = lv_duty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_value.
|
||||
DATA lv_duty TYPE decfloat34.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
call( EXPORTING iv_value = -100 iv_country = 'US' iv_category = 'FOOD'
|
||||
IMPORTING ev_duty = lv_duty ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user