anchor.diff:        CONCATENATE '1' lv_type lv_bits+28(4) INTO lv_result.
         CONCATENATE lv_result '0' lv_bits+21(7) INTO lv_result.
       ELSE.
  -* todo, this can be done easier with some shifting
  -      BREAK-POINT.
  +* use shifting?
  +      RAISE EXCEPTION TYPE lcx_exception
  +        EXPORTING
  +          iv_text = 'Todo, encoding length'.                "#EC NOTEXT
       ENDIF.
   
   * convert bit string to xstring
  
positive.code: 
      CLASS-METHODS sha1 IMPORTING iv_type TYPE t_type
                                   iv_data TYPE xstring
                         RETURNING value(rv_sha1) TYPE t_sha1.
  
      CLASS-METHODS sha1_raw IMPORTING iv_data TYPE xstring
                         RETURNING value(rv_sha1) TYPE t_sha1.
  
  ENDCLASS.                    "lcl_hash DEFINITION
  
  
negative.code:         act = lv_i ).
  
    ENDMETHOD.                    "convert_int
  
    METHOD encode_decode_pack_multiple.
  
      DATA: lt_objects TYPE tt_objects,
            ls_object  LIKE LINE OF lt_objects,
            lt_nodes   TYPE tt_nodes,
            ls_node    LIKE LINE OF lt_nodes,
            ls_commit  TYPE st_commit,
            lt_result  TYPE tt_objects,
            lv_data    TYPE xstring.
  
  
  * blob
      lv_data = '123456789ABCDEF545794254754554'.
      CLEAR ls_object.
      ls_object-sha1 = lcl_hash=>sha1( iv_type = gc_blob iv_data = lv_data ).
      ls_object-type = gc_blob.
      ls_object-data = lv_data.
      APPEND ls_object TO lt_objects.
  
  * commit
      CLEAR ls_commit.
      ls_commit-tree      = '5F46CB3C4B7F0B3600B64F744CDE614A283A88DC'.
      ls_commit-parent    = '5F46CB3C4B7F0B3600B64F744CDE614A283A88DC'.
      ls_commit-author    = 'John Foobar'.
      ls_commit-committer = 'John Foobar'.
      ls_commit-body      = 'body'.
      lv_data = lcl_pack=>encode_commit( ls_commit ).
      CLEAR ls_object.
      ls_object-sha1 = lcl_hash=>sha1( iv_type = gc_commit iv_data = lv_data ).
      ls_object-type = gc_commit.
      ls_object-data = lv_data.
      APPEND ls_object TO lt_objects.
  
  * tree
      CLEAR ls_node.
      ls_node-chmod     = '12456'.
      ls_node-name      = 'foobar.abap'.
      ls_node-sha1      = '5F46CB3C4B7F0B3600B64F744CDE614A283A88DC'.
      APPEND ls_node TO lt_nodes.
      lv_data = lcl_pack=>encode_tree( lt_nodes ).
      CLEAR ls_object.
      ls_object-sha1 = lcl_hash=>sha1( iv_type = gc_tree iv_data = lv_data ).
      ls_object-type = gc_tree.
      ls_object-data = lv_data.
      APPEND ls_object TO lt_objects.
  
  
      CLEAR lv_data.
      lv_data = lcl_pack=>encode( lt_objects ).
      lt_result = lcl_pack=>decode( lv_data ).
  
      cl_abap_unit_assert=>assert_equals(
          exp = lt_objects
          act = lt_result ).
  
    ENDMETHOD.                    "encode_decode_pack_multiple
  
    METHOD encode_decode_pack_short.
  
  