whoops run from 0-255 not 0-254, and other test corrections
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 11 Oct 2018 07:09:16 +0000 (08:09 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 11 Oct 2018 07:09:16 +0000 (08:09 +0100)
operators/operators.t.cc

index b5ac0185adba82ad8424401a50807f63ecb383ea..c025c492198786f2c66b2923a40d58ffc9869c27 100644 (file)
@@ -20,7 +20,7 @@
             x1 = (uint8_t)x;                                  \
             y1 = (uint8_t)y;                                  \
             uint16_t z1 = x1 op y1;                           \
-            if (z1 != z) {                                    \
+            if ((uint8_t)z1 != (uint8_t)z) {                  \
                 printf("FAILED %s %d %d %d %d\n",             \
                     xstr(op), i, j, z, z1);                   \
             }                                                 \
@@ -39,18 +39,18 @@ int main(int argc, char *argv[])
     //printf("hello %lx\n", o);
 
     int8_t x=0, y=0;
-    uint16_t x1, y1;
+    int16_t x1, y1;
 
     for (int i=0, x=0; i < 256; i++, x++) {
         //printf("hello %x\n", (int)(uint8_t)x);
-        for (int j, y=0; j < 255; j++, y++) {
+        for (int j=0, y=0; j < 256; j++, y++) {
             operator_check( plus )
             operator_check( minus )
+            operator_check( mul )
             operator_check( divide )
             operator_check( remainder )
             operator_check( shiftr )
             operator_check( shiftl )
-            operator_check( mul )
         }
     }
 }