abapGit/src/zlib/zcl_abapgit_zlib_stream.clas.testclasses.abap
sandraros 8e2e2f13fc shortdump ZCL_ABAPGIT_ZLIB->Decompress #2483 (#2600)
* shortdump ZCL_ABAPGIT_ZLIB->Decompress #2483

Short dump ASSERTION_FAILED while pulling from a Git repository.

It's because of block type '00' (variable `lv_btype`) not handled at all.

00 is "non-compressed blocks", see https://www.ietf.org/rfc/rfc1951.txt section 3.2.4

The issue used to happen with Azure DevOps website, for "tree" objects (100644...) but not all tree objects.

Correction : algorithm added to handle non-compressed blocks. Test method added to complete the current test for blocks with fixed Huffman codes (01). Also one test method added for testing blocks with dynamic Huffman codes (10), test data taken from ZAZLIB.

* Lint code alignment issue
2019-03-30 03:19:55 -07:00

54 lines
1002 B
ABAP

CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS FINAL.
PRIVATE SECTION.
METHODS: test FOR TESTING.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD test.
DATA: lo_stream TYPE REF TO zcl_abapgit_zlib_stream,
lv_remaining TYPE i,
lv_int TYPE i,
lv_bits TYPE string,
lv_bytes TYPE xstring.
CREATE OBJECT lo_stream
EXPORTING
iv_data = '112233445566'.
lv_bits = lo_stream->take_bits( 8 ).
cl_abap_unit_assert=>assert_equals(
act = lv_bits
exp = '00010001' ).
lv_remaining = lo_stream->remaining( ).
cl_abap_unit_assert=>assert_equals(
act = lv_remaining
exp = 6 ).
lv_int = lo_stream->take_int( 8 ).
cl_abap_unit_assert=>assert_equals(
act = lv_int
exp = 34 ).
lv_bytes = lo_stream->take_bytes( 2 ).
cl_abap_unit_assert=>assert_equals(
act = lv_bytes
exp = '3344' ).
ENDMETHOD.
ENDCLASS.