mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 14:06:24 +08:00
split tests for shift_formula (#886)
This commit is contained in:
parent
d60571434d
commit
74345edd32
|
@ -68,7 +68,32 @@ CLASS lcl_excel_common_test DEFINITION FOR TESTING
|
|||
iv_shift_cols TYPE i
|
||||
iv_shift_rows TYPE i
|
||||
iv_expected TYPE string.
|
||||
METHODS: shift_formula FOR TESTING.
|
||||
METHODS: shift_formula_basic FOR TESTING,
|
||||
shift_formula_rightdown FOR TESTING,
|
||||
shift_formula_leftup FOR TESTING,
|
||||
shift_formula_fixedcolrows FOR TESTING,
|
||||
shift_formula_mixedfixedrows FOR TESTING,
|
||||
shift_formula_rangename FOR TESTING,
|
||||
shift_formula_stringlitconc FOR TESTING,
|
||||
shift_formula_extref FOR TESTING,
|
||||
shift_formula_charblanks FOR TESTING,
|
||||
shift_formula_stringblanks FOR TESTING,
|
||||
shift_formula_funcnoargs FOR TESTING,
|
||||
shift_formula_nocellref FOR TESTING,
|
||||
shift_formula_empty FOR TESTING,
|
||||
shift_formula_referr_colunder FOR TESTING,
|
||||
shift_formula_referr_rowunder FOR TESTING,
|
||||
shift_formula_referr_rowcolund FOR TESTING,
|
||||
shift_formula_sheet_nodigit FOR TESTING,
|
||||
shift_formula_sheet_nodig FOR TESTING,
|
||||
shift_formula_sheet_special FOR TESTING,
|
||||
shift_formula_resp_blanks_1 FOR TESTING,
|
||||
shift_formula_resp_blanks_2 FOR TESTING,
|
||||
shift_formula_range FOR TESTING,
|
||||
shift_formula_notcols FOR TESTING,
|
||||
shift_formula_name FOR TESTING,
|
||||
shift_formula_refcolumn1 FOR TESTING,
|
||||
shift_formula_refcolumn2 FOR TESTING.
|
||||
METHODS is_cell_in_range_ulc_in FOR TESTING.
|
||||
METHODS is_cell_in_range_lrc_in FOR TESTING.
|
||||
METHODS is_cell_in_range_leftside_out FOR TESTING.
|
||||
|
@ -1181,7 +1206,7 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula.
|
||||
METHOD shift_formula_basic.
|
||||
|
||||
" Very basic check
|
||||
macro_shift_formula(
|
||||
|
@ -1190,6 +1215,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 0
|
||||
iv_expected = 'C17' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_rightdown.
|
||||
|
||||
" Check shift right and down
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'C17'
|
||||
|
@ -1197,6 +1226,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 3
|
||||
iv_expected = 'E20' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_leftup.
|
||||
|
||||
" Check shift left and up
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'C17'
|
||||
|
@ -1204,6 +1237,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = -3
|
||||
iv_expected = 'A14' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_fixedcolrows.
|
||||
|
||||
" Fixed columns/rows
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = '$C$17'
|
||||
|
@ -1211,6 +1248,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = '$C$17' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_mixedfixedrows.
|
||||
|
||||
" Operators and Ranges, mixed fixed rows or columns
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'SUM($C17:C$23)+C30'
|
||||
|
@ -1218,6 +1259,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 11
|
||||
iv_expected = 'SUM($C28:D$23)+D41' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_rangename.
|
||||
|
||||
" Operators and Rangename
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'RNGNAME1+C7'
|
||||
|
@ -1225,6 +1270,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = -4
|
||||
iv_expected = 'RNGNAME1+B3' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_stringlitconc.
|
||||
|
||||
" String literals and string concatenation
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = '"Date:"&TEXT(B2)'
|
||||
|
@ -1232,6 +1281,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = '"Date:"&TEXT(C3)' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_extref.
|
||||
|
||||
" External sheet reference
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = '[TEST6.XLSX]SHEET1!A1'
|
||||
|
@ -1239,6 +1292,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 11
|
||||
iv_expected = '[TEST6.XLSX]SHEET1!B12' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_charblanks.
|
||||
|
||||
" superflous blanks, multi-argument functions, literals in function, unknown functions
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = `X(B13, "KK" ) `
|
||||
|
@ -1246,6 +1303,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = `X(C14, "KK" ) ` ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_stringblanks.
|
||||
|
||||
" same as above - but with string input instead of Char-input
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = `SIN(SIN(SIN(SIN(E22))))`
|
||||
|
@ -1253,6 +1314,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'SIN(SIN(SIN(SIN(E23))))' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_funcnoargs.
|
||||
|
||||
" Functions w/o arguments, No cellreferences
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'HEUTE()'
|
||||
|
@ -1260,6 +1325,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 5
|
||||
iv_expected = 'HEUTE()' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_nocellref.
|
||||
|
||||
" No cellreferences
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = '"B2"'
|
||||
|
@ -1267,6 +1336,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 5
|
||||
iv_expected = '"B2"' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_empty.
|
||||
|
||||
" Empty
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = ''
|
||||
|
@ -1274,6 +1347,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 5
|
||||
iv_expected = '' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_referr_colunder.
|
||||
|
||||
" Referencing error , column only , underflow
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'A1+$A1+A$1+$A$1+B2'
|
||||
|
@ -1281,6 +1358,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 0
|
||||
iv_expected = '#REF!+$A1+#REF!+$A$1+A2' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_referr_rowunder.
|
||||
|
||||
" Referencing error , row only , underflow
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'A1+$A1+A$1+$A$1+B2'
|
||||
|
@ -1288,6 +1369,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = -1
|
||||
iv_expected = '#REF!+#REF!+A$1+$A$1+B1' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_referr_rowcolund.
|
||||
|
||||
" Referencing error , row and column , underflow
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'A1+$A1+A$1+$A$1+B2'
|
||||
|
@ -1295,6 +1380,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = -1
|
||||
iv_expected = '#REF!+#REF!+#REF!+$A$1+A1' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_sheet_nodigit.
|
||||
|
||||
" Sheet name not ending with digit
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'Sheet!A1'
|
||||
|
@ -1302,6 +1391,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'Sheet!B2' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_sheet_nodig.
|
||||
|
||||
" Sheet name ending with digit
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'Sheet2!A1'
|
||||
|
@ -1309,6 +1402,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'Sheet2!B2' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_sheet_special.
|
||||
|
||||
" Sheet name with special characters
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = |'Sheet name'!A1|
|
||||
|
@ -1316,6 +1413,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = |'Sheet name'!B2| ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_resp_blanks_1.
|
||||
|
||||
" Respecting blanks
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'SUBTOTAL(109,Table1[SUM 1])'
|
||||
|
@ -1323,6 +1424,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'SUBTOTAL(109,Table1[SUM 1])' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_resp_blanks_2.
|
||||
|
||||
" Respecting blanks
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'B4 & C4'
|
||||
|
@ -1330,6 +1435,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'B5 & C5' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_range.
|
||||
|
||||
" F_1 is a range name, not a cell address
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'SUM(F_1,F_2)'
|
||||
|
@ -1337,6 +1446,9 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'SUM(F_1,F_2)' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_notcols.
|
||||
" RC are not columns
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'INDIRECT("RC[4]",FALSE)'
|
||||
|
@ -1344,6 +1456,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'INDIRECT("RC[4]",FALSE)' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_name.
|
||||
|
||||
" A1 is a sheet name
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = |'A1'!$A$1|
|
||||
|
@ -1351,6 +1467,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = |'A1'!$A$1| ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_refcolumn1.
|
||||
|
||||
" Reference to another column in the same row of a Table, with a space in the column name
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'Tbl[[#This Row],[Air fare]]'
|
||||
|
@ -1358,6 +1478,10 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
|
|||
iv_shift_rows = 1
|
||||
iv_expected = 'Tbl[[#This Row],[Air fare]]' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shift_formula_refcolumn2.
|
||||
|
||||
" Reference to another column in the same row of a Table, inside more complex expression
|
||||
macro_shift_formula(
|
||||
iv_reference_formula = 'Tbl[[#This Row],[Air]]+A1'
|
||||
|
|
Loading…
Reference in New Issue
Block a user