From 2dbf80388ef5b3f24af9dc717a2f32809cd5e9ea Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Sat, 10 Nov 2018 15:58:33 +0100 Subject: [PATCH] Add tests for (N)'DF foo!bar' and (N)'DF foo&bar'. --- tests/test-if.lst.ok | 190 ++++++++++++++++++++++++------------------- tests/test-if.mac | 22 +++++ 2 files changed, 128 insertions(+), 84 deletions(-) diff --git a/tests/test-if.lst.ok b/tests/test-if.lst.ok index ffa4156..4c0c146 100644 --- a/tests/test-if.lst.ok +++ b/tests/test-if.lst.ok @@ -28,98 +28,120 @@ 28 000003 001 .byte 1 29 .endc 30 - 31 ; blank (string) - 32 000004 001 .iif b ^// .byte 1 - 33 .iif b .byte 0 - 34 .iif nb <> .byte 0 - 35 000005 001 .iif nb ^/x/ .byte 1 + 31 ; multiple df and ndf + 32 000004 001 .iif df defd & defd2, .byte 1 + 33 .iif df defd & undefd .byte 0 + 34 .iif df undefd & defd, .byte 0 + 35 .iif df undefd & undefd .byte 0 36 - 37 ; identical (strings) - 38 000006 001 .iif idn ^/a/ .byte 1 - 39 .iif idn ^/a/ .byte 0 - 40 .iif dif ^/a/ .byte 0 - 41 000007 001 .iif dif ^/a/ .byte 1 - 42 - 43 ; skip P1 and P2 - 44 - 45 ; equal to zero (value) - 46 000000 001 .iif eq zero .byte 1 - 47 000001 .iif eq one .byte 0 - 48 000000 .iif ne zero .byte 0 - 49 000001 001 .iif ne one .byte 1 - 50 - 51 000000 001 .iif z zero .byte 1 - 52 000001 .iif z one .byte 0 - 53 000000 .iif nz zero .byte 0 - 54 000001 001 .iif nz one .byte 1 - 55 - 56 ; greater than zero (value) - 57 177777 .iif gt min1 .byte 0 - 58 000000 .iif gt zero .byte 0 - 59 000001 001 .iif gt one .byte 1 - 60 - 61 177777 .iif g min1 .byte 0 - 62 000000 .iif g zero .byte 0 - 63 000001 001 .iif g one .byte 1 + 37 .iif ndf defd & defd2 .byte 0 + 38 .iif ndf defd & undefd, .byte 0 + 39 .iif ndf undefd & defd, .byte 0 + 40 000005 001 .iif ndf undefd & undefd .byte 1 + 41 + 42 ; multiple df or ndf + 43 000006 001 .iif df defd ! defd2, .byte 1 + 44 000007 001 .iif df defd ! undefd .byte 1 + 45 000010 001 .iif df undefd ! defd, .byte 1 + 46 .iif df undefd ! undefd .byte 0 + 47 + 48 .iif ndf defd ! defd2, .byte 0 + 49 000011 001 .iif ndf defd ! undefd .byte 1 + 50 000012 001 .iif ndf undefd ! defd .byte 1 + 51 000013 001 .iif ndf undefd ! undefd .byte 1 + 52 + 53 ; blank (string) + 54 000014 001 .iif b ^// .byte 1 + 55 .iif b .byte 0 + 56 .iif nb <> .byte 0 + 57 000015 001 .iif nb ^/x/ .byte 1 + 58 + 59 ; identical (strings) + 60 000016 001 .iif idn ^/a/ .byte 1 + 61 .iif idn ^/a/ .byte 0 + 62 .iif dif ^/a/ .byte 0 + 63 000017 001 .iif dif ^/a/ .byte 1 64 - 65 ; greater than or equal to zero (value) - 66 177777 .iif ge min1 .byte 0 - 67 000000 001 .iif ge zero .byte 1 - 68 000001 001 .iif ge one .byte 1 - 69 - 70 ; less than zero (value) - 71 177777 001 .iif lt min1 .byte 1 - 72 000000 .iif lt zero .byte 0 - 73 000001 .iif lt one .byte 0 - 74 - 75 177777 001 .iif l min1 .byte 1 - 76 000000 .iif l zero .byte 0 - 77 000001 .iif l one .byte 0 - 78 - 79 ; less than or equal to zero (value) - 80 177777 001 .iif le min1 .byte 1 - 81 000000 001 .iif le zero .byte 1 - 82 000001 .iif le one .byte 0 - 83 - 84 ; expression with separating comma - 85 000000 001 .iif z one - one, .byte 1 - 86 000000 .iif nz one - one, .byte 0 - 87 000001 001 .iif nz 2 - one, .byte 1 - 88 - 89 ; labels - 90 000000 001 .iif z zero, lab1: .byte 1 - 91 000001 001 .iif nz one, lab2: .byte 1 - 92 - 93 ; multiline conditions - 94 000001 .if ne one - 95 000030 001 .byte 1 - 96 .iff - 97 .byte 0 - 98 .ift - 99 000031 001 .byte 1 - 100 .iftf - 101 000032 001 .byte 1 - 102 .endc - 103 - 104 000001 .if eq one - 105 .byte 0 - 106 .iff - 107 000033 001 .byte 1 - 108 .ift - 109 .byte 0 - 110 .iftf - 111 000034 001 .byte 1 - 112 .endc - 112 + 65 ; skip P1 and P2 + 66 + 67 ; equal to zero (value) + 68 000000 001 .iif eq zero .byte 1 + 69 000001 .iif eq one .byte 0 + 70 000000 .iif ne zero .byte 0 + 71 000001 001 .iif ne one .byte 1 + 72 + 73 000000 001 .iif z zero .byte 1 + 74 000001 .iif z one .byte 0 + 75 000000 .iif nz zero .byte 0 + 76 000001 001 .iif nz one .byte 1 + 77 + 78 ; greater than zero (value) + 79 177777 .iif gt min1 .byte 0 + 80 000000 .iif gt zero .byte 0 + 81 000001 001 .iif gt one .byte 1 + 82 + 83 177777 .iif g min1 .byte 0 + 84 000000 .iif g zero .byte 0 + 85 000001 001 .iif g one .byte 1 + 86 + 87 ; greater than or equal to zero (value) + 88 177777 .iif ge min1 .byte 0 + 89 000000 001 .iif ge zero .byte 1 + 90 000001 001 .iif ge one .byte 1 + 91 + 92 ; less than zero (value) + 93 177777 001 .iif lt min1 .byte 1 + 94 000000 .iif lt zero .byte 0 + 95 000001 .iif lt one .byte 0 + 96 + 97 177777 001 .iif l min1 .byte 1 + 98 000000 .iif l zero .byte 0 + 99 000001 .iif l one .byte 0 + 100 + 101 ; less than or equal to zero (value) + 102 177777 001 .iif le min1 .byte 1 + 103 000000 001 .iif le zero .byte 1 + 104 000001 .iif le one .byte 0 + 105 + 106 ; expression with separating comma + 107 000000 001 .iif z one - one, .byte 1 + 108 000000 .iif nz one - one, .byte 0 + 109 000001 001 .iif nz 2 - one, .byte 1 + 110 + 111 ; labels + 112 000000 001 .iif z zero, lab1: .byte 1 + 113 000001 001 .iif nz one, lab2: .byte 1 + 114 + 115 ; multiline conditions + 116 000001 .if ne one + 117 000040 001 .byte 1 + 118 .iff + 119 .byte 0 + 120 .ift + 121 000041 001 .byte 1 + 122 .iftf + 123 000042 001 .byte 1 + 124 .endc + 125 + 126 000001 .if eq one + 127 .byte 0 + 128 .iff + 129 000043 001 .byte 1 + 130 .ift + 131 .byte 0 + 132 .iftf + 133 000044 001 .byte 1 + 134 .endc + 134 Symbol table -. ******R 001 DEFD2 =000003 LAB2 000027R 001 ONE =000001 -DEFD =000002 LAB1 000026R 001 MIN1 =177777 ZERO =000000 +. ******R 001 DEFD2 =000003 LAB2 000037R 001 ONE =000001 +DEFD =000002 LAB1 000036R 001 MIN1 =177777 ZERO =000000 Program sections: . ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV) - 000035 001 (RW,I,LCL,REL,CON,NOSAV) + 000045 001 (RW,I,LCL,REL,CON,NOSAV) diff --git a/tests/test-if.mac b/tests/test-if.mac index e8d6e79..f25042a 100644 --- a/tests/test-if.mac +++ b/tests/test-if.mac @@ -28,6 +28,28 @@ min1 = -1 .byte 1 .endc + ; multiple df and ndf + .iif df defd & defd2, .byte 1 + .iif df defd & undefd .byte 0 + .iif df undefd & defd, .byte 0 + .iif df undefd & undefd .byte 0 + + .iif ndf defd & defd2 .byte 0 + .iif ndf defd & undefd, .byte 0 + .iif ndf undefd & defd, .byte 0 + .iif ndf undefd & undefd .byte 1 + + ; multiple df or ndf + .iif df defd ! defd2, .byte 1 + .iif df defd ! undefd .byte 1 + .iif df undefd ! defd, .byte 1 + .iif df undefd ! undefd .byte 0 + + .iif ndf defd ! defd2, .byte 0 + .iif ndf defd ! undefd .byte 1 + .iif ndf undefd ! defd .byte 1 + .iif ndf undefd ! undefd .byte 1 + ; blank (string) .iif b ^// .byte 1 .iif b .byte 0