Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
56
tasks_gen/train/G1931/reference/e_rental_test.clas.abap
Normal file
56
tasks_gen/train/G1931/reference/e_rental_test.clas.abap
Normal file
@@ -0,0 +1,56 @@
|
||||
CLASS {{p}}e_rental_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS setup.
|
||||
METHODS short_rental_fee FOR TESTING.
|
||||
METHODS long_rental_fee FOR TESTING.
|
||||
METHODS default_group FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}e_rental_test IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_RENTAL_FEE' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
DATA lt_rental TYPE STANDARD TABLE OF {{p}}rental WITH EMPTY KEY.
|
||||
go_env->clear_doubles( ).
|
||||
lt_rental = VALUE #(
|
||||
( rental_id = 'A1' car_group = 'A' season = 'L' rental_days = 2 )
|
||||
( rental_id = 'B1' car_group = 'B' season = 'H' rental_days = 9 )
|
||||
( rental_id = 'Z1' car_group = 'Z' season = 'H' rental_days = 1 ) ).
|
||||
go_env->insert_test_data( lt_rental ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD short_rental_fee.
|
||||
SELECT SINGLE fee FROM {{p}}i_rental_fee
|
||||
WHERE rental_id = 'A1' INTO @DATA(lv_fee).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '70.00' )
|
||||
act = CONV decfloat34( lv_fee ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD long_rental_fee.
|
||||
SELECT SINGLE fee FROM {{p}}i_rental_fee
|
||||
WHERE rental_id = 'B1' INTO @DATA(lv_fee).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '495.00' )
|
||||
act = CONV decfloat34( lv_fee ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD default_group.
|
||||
SELECT SINGLE fee FROM {{p}}i_rental_fee
|
||||
WHERE rental_id = 'Z1' INTO @DATA(lv_fee).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '46.00' )
|
||||
act = CONV decfloat34( lv_fee ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
22
tasks_gen/train/G1931/reference/i_rental_fee.ddls.asddls
Normal file
22
tasks_gen/train/G1931/reference/i_rental_fee.ddls.asddls
Normal file
@@ -0,0 +1,22 @@
|
||||
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||
@EndUserText.label: 'Rental fee'
|
||||
define view entity {{P}}I_RENTAL_FEE
|
||||
as select from {{p}}rental as rental
|
||||
{
|
||||
key rental.rental_id as rental_id,
|
||||
rental.car_group as car_group,
|
||||
rental.rental_days as rental_days,
|
||||
cast(
|
||||
case rental.car_group
|
||||
when 'C' then case rental.season when 'H' then 96 else 80 end
|
||||
when 'B' then case rental.season when 'H' then 60 else 50 end
|
||||
else case rental.season when 'H' then 36 else 30 end
|
||||
end
|
||||
* case when rental.rental_days >= 7 then rental.rental_days - 1 else rental.rental_days end
|
||||
+ case rental.car_group
|
||||
when 'C' then 25
|
||||
when 'B' then 15
|
||||
else 10
|
||||
end
|
||||
as abap.dec( 15, 2 ) ) as fee
|
||||
}
|
||||
Reference in New Issue
Block a user