?login_element?

Subversion Repositories NedoOS

Rev

Rev 539 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.     ;; few more test cases not covered by regular tests,
  2.     ;; but were discovered by code coverage as code not executed in tests
  3.  
  4.     ; some tests need more strict syntax rules to hit specific code paths
  5.     OPT reset --syntax=ab
  6.  
  7.     xor     [1234   ; "Operand expected" error when parsing of no-memory argument fails
  8.  
  9.     call            ; "Operand expected" error
  10.  
  11.     ld      a,high af           ; tricky way to write "ld a,a" :) ("high af" covered)
  12.  
  13.     in      low af,(c)          ; tricky way to write "in f,(c)" ("low af" covered)
  14.  
  15.     ; nonexistent register pairs (with possible match) in `GetRegister` function
  16.     pop az : pop ha : pop xa : pop ya : pop YA
  17.  
  18.     ; invalid registers in common ALU instructions
  19.     xor af : xor sp : xor i : xor r : xor f
  20.  
  21.     adc     hl      ; "Comma expected" error
  22.     adc     hl,ix   ; invalid instr.
  23.     adc     b ,, c  ; multiarg
  24.  
  25.     add     hl              ; "Comma expected" error
  26.     ex      hl              ; "Comma expected" error
  27.     ex      (sp)            ; "Comma expected" error
  28.  
  29.     and     b ,, c          ; multiarg
  30.     bit     5,c ,, 3,(ix+4) ; multiarg
  31.     cp      b ,, c          ; multiarg
  32.     inc     b ,, c          ; multiarg
  33.     in      a,(1) ,, d,(c)  ; multiarg
  34.     djnz    $ ,, $          ; multiarg
  35.     jr      $ ,, $          ; multiarg
  36.     ldd     a,(hl) ,, b,(hl); multiarg
  37.     ldi     a,(hl) ,, b,(hl); multiarg
  38.     ldd     ,,              ; freaking multiarg syntax allows for this!
  39.     ldi     ,,              ; freaking multiarg syntax allows for this!
  40.  
  41.     djnz                    ; "Operand expected" error
  42.     djnz    $+2-128-1       ; just outside of range
  43.     djnz    $+2+127+1       ; just outside of range
  44.  
  45.     dec     r               ; illegal dec/inc instruction
  46.     inc     r
  47.     dec     af
  48.     inc     af
  49.  
  50.     jr      p,$             ; illegal JR conditions
  51.     jr      ns,$
  52.     jr      m,$
  53.     jr      s,$
  54.     jr      po,$
  55.     jr      pe,$
  56.  
  57.     ; illegal instructions (exercising all code paths)
  58.     ld      (1234),af
  59.     ld      (1234),r
  60.     ld      (af),a
  61.     ldd     a,(af)
  62.     ldi     a,(af)
  63.     ldd     b,c
  64.     ldi     b,c
  65.     ldd     (hl),i
  66.     ldi     (hl),i
  67.     ldd     (ix),i
  68.     ldi     (iy),i
  69.     ldi     b,(af)
  70.     ldi     bc,a
  71.     ldi     de,a
  72.     ldi     hl,a
  73.  
  74.     ; normal instructions, different syntax (not used yet by any test)
  75.     exa     : ex af,af'     ; "ex af,af'" shortcut
  76.    exd     : ex de,hl      ; "ex de,hl" shortcut
  77.    inf     : in f,(c)      ; "in f,(c)" shortcut
  78.  
  79.    OPT reset --syntax=abF  ; no fakes allowed
  80.    ldd                     ; regular ldd
  81.    ldi                     ; regular ldi
  82.    ldd     a,(hl)          ; regular ldd with "unexpected ...." error when fakes are OFF
  83.    ldi     a,(hl)          ; regular ldi with "unexpected ...." error when fakes are OFF
  84.  
  85.    ;; part 2 (new commit)
  86.    ; illegal instructions (exercising all code paths)
  87.    in      hl,(c)
  88.    out     (c),hl
  89.    bit     -1,a
  90.    bit     8,b
  91.    res     -1,a
  92.    res     8,b
  93.    set     -1,a
  94.    set     8,b
  95.    rl      sp
  96.    rlc     sp
  97.    rr      sp
  98.    rrc     sp
  99.    sla     sp
  100.    sli     sp
  101.    sra     sp
  102.    srl     sp
  103.  
  104.    ; multiarg
  105.    or      b ,, c ,, 123
  106.    xor     b ,, c ,, 123
  107.    out     (c),b ,, (254),a
  108.    res     5,c ,, 3,(ix+4),d
  109.    set     5,c ,, 3,(ix+4),d
  110.    rl      a ,, b
  111.    rlc     a ,, b
  112.    rr      a ,, b
  113.    rrc     a ,, b
  114.    rst     $08 ,, $38
  115.    sbc     a ,, b
  116.    sla     a ,, b
  117.    sli     a ,, b
  118.    sra     a ,, b
  119.    srl     a ,, b
  120.  
  121.    ; no fakes allowed
  122.    rl      bc
  123.    rr      bc
  124.    sla     hl
  125.    sla     bc
  126.    sli     bc
  127.    sra     bc
  128.    srl     bc
  129.  
  130.    ; "Comma expected" error
  131.    sbc     hl
  132.    sub     hl
  133.  
  134.    ; reverse pop code path exercise
  135.    OPT reset --syntax=ab --reversepop
  136.    pop     af,,bc,,de,,hl,,ix,,iy      ;; regular + multiarg
  137.    pop     sp          ; illegal
  138.  
  139.    ;; part 3 (new commit, focusing on branching in the code, exercising more combinations and code paths)
  140.    ; these tests (whole this file) are unfortunately very implementation based, in case of major refactorings they may
  141.    ; quickly lose their functionality (the machine code produced should be the same, but code coverage may regress).
  142.  
  143.    ; illegal instructions (exercising all code paths)
  144.    sbc     hl,af
  145.    sub     hl,af
  146.  
  147.    ;; no fakes allowed
  148.    OPT reset --syntax=abF
  149.    sub     hl,bc
  150.  
  151.    ;; branches extra coverage - not going to comment on each one, as these exercise very specific code paths
  152.    ;; of current implementation (based on v1.13.3) and there's nothing special about them in general way
  153.  
  154.    ret     np
  155.    ret     px
  156.    ld      a,ixn
  157.    ld      a,ixhn
  158.    ld      a,ixln
  159.    ld      a,iyn
  160.    ld      a,iyhn
  161.    ld      a,iyln
  162.    ld      a,IXN
  163.    ld      a,IXHN
  164.    ld      a,IXLN
  165.    ld      a,IYN
  166.    ld      a,IYHN
  167.    ld      a,IYLN
  168.    ex      af,bc
  169.    jp      [hl
  170.    jp      [123]
  171.    ld      a
  172.    ld      hl,bc
  173.    ld      hl,de
  174.    ld      (ix),bc
  175.    ld      (ix),de
  176.    ld      (ix),hl
  177.    ld      (hl),bc
  178.    ld      (hl),de
  179.    ld      (hl),hl
  180.    ld      bc,(hl)
  181.    ld      bc,(ix)
  182.    ld      1,bc
  183.    ld      (bc
  184.    ld      (bc)
  185.    ld      (bc),b
  186.  
  187.    OPT reset --syntax=ab
  188.    ld      (ix+127),bc
  189.    ld      (ix+127),de
  190.    ld      (ix+127),hl
  191.    ld      bc,(ix+127)
  192.  
  193.    OPT reset --syntax=abf
  194.    ldd     a
  195.    ldd     a,
  196.    ldd     a,(hl)
  197.    ldd     b
  198.    ldd     b,
  199.    ldd     b,(hl)
  200.    ldd     (hl)
  201.    ldd     (hl),
  202.    ldd     (hl),a
  203.    ldd     (iy)
  204.    ldd     (iy),
  205.    ldd     (iy),a
  206.    ldd     (de)
  207.    ldd     (de),
  208.    ldd     (de),a
  209.    ldd     (de),b
  210.  
  211.    ldi     a
  212.    ldi     a,
  213.    ldi     a,(hl)
  214.    ldi     b
  215.    ldi     bc
  216.    ldi     b,
  217.    ldi     b,(hl)
  218.    ldi     (hl)
  219.    ldi     (hl),
  220.    ldi     (hl),a
  221.    ldi     (iy)
  222.    ldi     (iy),
  223.    ldi     (iy),a
  224.    ldi     (de)
  225.    ldi     (de),
  226.    ldi     (de),a
  227.    ldi     (de),b
  228.    ldi     hl,(hl)
  229.  
  230.    ;; part 4 (more of the branching stuff, handpicked from local detailed coverage report)
  231.    ld      a,[ix]
  232.    ex      (bc),hl
  233.    ex      (sp
  234.    in      b
  235.    in      (c)
  236.    jr      $+2-129
  237.    jr      $+2+128
  238.    xor     hl,0
  239.    adc     bc,hl
  240.  
  241.    OPT reset --syntax=abF
  242.    ld      de,(ix)
  243.  
  244.    OPT reset --syntax=a
  245.    bit     -1,a
  246.    call    nz
  247.    ex      (sp),de
  248.    im      3
  249.    in      b,(254)
  250.    jp      nz
  251.    jr      nz
  252.    ld      a,(bc
  253.    ld      a,(de
  254.    ld      a,[1234
  255.    ld      (ix),ix
  256.    ld      sp,(iy+13)
  257.    ld      de,[1234
  258.    ld      ix,[1234
  259.    ldd     a,[de
  260.    ldd     a,[hl
  261.    ldd     a,[ix+3
  262.    ldd     [hl
  263.    ldd     [sp],a
  264.    ldi     a,[de
  265.    ldi     a,[hl
  266.    ldi     a,[ix+3
  267.    ldi     [hl
  268.    ldi     [sp],a
  269.    ldi     l,[hl
  270.    ldi     l,[ix+3
  271.    out     (c)
  272.    out     (c),1
  273.    out     (254),h
  274.    push    e
  275.    sub     bc,bc
  276.  
  277.    ;; part 5 - improving coverage after adding new fake instructions
  278.    adc     de,af
  279.    adc     de,1
  280.    adc     af,hl
  281.    add     de,af
  282.    add     de,2
  283.    add     af,hl
  284.    sbc     de,af
  285.    sbc     de,3
  286.    sbc     af,hl
  287.    sub     de,af
  288.    sub     de,4
  289.    sub     af,hl
  290.