Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
107
tasks_gen/train/G1125/reference/prt_test.clas.abap
Normal file
107
tasks_gen/train/G1125/reference/prt_test.clas.abap
Normal file
@@ -0,0 +1,107 @@
|
||||
CLASS {{p}}prt_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS price_of
|
||||
IMPORTING iv_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool DEFAULT abap_false
|
||||
EXPORTING ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
ev_price TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS flyers_fee FOR TESTING.
|
||||
METHODS minimum_fee FOR TESTING.
|
||||
METHODS posters_fee FOR TESTING.
|
||||
METHODS express_fee FOR TESTING.
|
||||
METHODS manual_quote FOR TESTING.
|
||||
METHODS invalid_quantity FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}prt_test IMPLEMENTATION.
|
||||
METHOD price_of.
|
||||
ev_skip = abap_false.
|
||||
ev_note = ''.
|
||||
ev_price = 0.
|
||||
CALL FUNCTION '{{P}}PRT_PRICE'
|
||||
EXPORTING
|
||||
iv_job_type = iv_type
|
||||
iv_quantity = iv_quantity
|
||||
iv_express = iv_express
|
||||
IMPORTING
|
||||
ev_skip = ev_skip
|
||||
ev_note = ev_note
|
||||
CHANGING
|
||||
cv_price = ev_price
|
||||
EXCEPTIONS
|
||||
invalid_quantity = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD flyers_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 400
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '20.00' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 10
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '10.00' )
|
||||
act = lv_price ).
|
||||
price_of( EXPORTING iv_type = `BC` iv_quantity = 10
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '5.00' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD posters_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `PO` iv_quantity = 100
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '115.00' )
|
||||
act = lv_price ).
|
||||
price_of( EXPORTING iv_type = `PO` iv_quantity = 101
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '104.54' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 202 iv_express = abap_true
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '12.63' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD manual_quote.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_note TYPE string.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `XX` iv_quantity = 50
|
||||
IMPORTING ev_skip = lv_skip ev_note = lv_note ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_true( lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `MANUAL QUOTE` act = lv_note ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '0.00' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_quantity.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 0
|
||||
IMPORTING ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user