mescc: scaffold: misc cleanups.

* scaffold/tests/44-switch.c (swits): More case labels.
* scaffold/tests/60-math.c: Discriminate return values.
* scaffold/tests/77-pointer-assign.c (memset)[__TINYC__]: Remove.
* scaffold/tests/79-int-array.c (test): Discriminate return values.
This commit is contained in:
Jan Nieuwenhuizen 2017-12-03 23:03:09 +01:00
parent 7a7bcda79e
commit 8b5e1dde3c
5 changed files with 38 additions and 28 deletions

View file

@ -46,6 +46,10 @@ swits (int c)
c = 34;
break;
}
case 5:
case 4:
case 3:
case 2:
case -1:
case 1:
x = 1;

View file

@ -45,57 +45,57 @@ test ()
if (0 < 0) return 1;
puts ("t: 2 < 1\n");
if (2 < 1) return 1;
if (2 < 1) return 2;
puts ("t: -1 < -2\n");
if (-1 < -2) return 1;
if (-1 < -2) return 3;
puts ("t: 0 < -1\n");
if (0 < -1) return 1;
if (0 < -1) return 4;
puts ("t: 0 > 0\n");
if (0 > 0) return 1;
if (0 > 0) return 5;
puts ("t: 1 > 2\n");
if (1 > 2) return 1;
if (1 > 2) return 6;
puts ("t: -2 > -1\n");
if (-2 > -1) return 1;
if (-2 > -1) return 7;
puts ("t: -1 > 0\n");
if (-1 > 0) return 1;
if (-1 > 0) return 9;
puts ("t: 1 == inc (0)\n");
if (1 == inc (0)) goto ok0;
return 1;
return 10;
ok0:
puts ("t: 0 < inc (0)\n");
if (0 < inc (0)) goto ok1;
return 1;
return 11;
ok1:
puts ("t: inc (0) + 2 != 3\n");
if (inc (0) + inc (1) != 3) return 1;
if (inc (0) + inc (1) != 3) return 12;
puts ("t: 4/2=");
i = 4 / 2;
if (i!=2) return 1;
if (i!=2) return 13;
i += 48;
putchar (i);
puts ("\n");
puts ("t: 3*4=\n");
i = 3 * 4;
if (i!=12) return 1;
if (i!=12) return 14;
puts ("t: i /= 4\n");
i /= 4;
if (i!=3) return 1;
if (i!=3) return 15;
puts ("t: i *= 4\n");
i *= 4;
if (i!=12) return 1;
if (i!=12) return 16;
puts ("t: 1 << 3\n");
if (1 << 3 != 8) return 1 << 3;
@ -114,37 +114,37 @@ test ()
i = -3;
puts ("t: -i\n");
if (-i != 3) return 1;
if (-i != 3) return 22;
puts ("t: -1 + 2\n");
if (-1 + 2 != 1) return 1;
if (-1 + 2 != 1) return 23;
puts ("t: 1 & 3\n");
if ((1 & 3) != 1) return 1;
if ((1 & 3) != 1) return 24;
puts ("t: ~0\n");
if (~0 != -1) return 1;
if (~0 != -1) return 25;
puts ("t: 1 | 3\n");
if ((1 | 2) != 3) return 1;
if ((1 | 2) != 3) return 26;
puts ("t: ^ 1 \n");
if ((1 ^ 3) != 2) return 1;
if ((1 ^ 3) != 2) return 27;
puts ("t: 3 == 3\n");
if ((3 == 3) != 1) return 1;
if ((3 == 3) != 1) return 28;
puts ("t: 3 != 3\n");
if ((3 != 3) != 0) return 1;
if ((3 != 3) != 0) return 29;
puts ("t: 011 == 15\n");
if (011 != 9) return 1;
if (011 != 9) return 30;
puts ("t: 0b11 == 3\n");
if (0b11 != 3) return 1;
if (0b11 != 3) return 31;
puts ("t: 0x11 == 3\n");
if (0x11 != 17) return 1;
if (0x11 != 17) return 32;
return 0;
}

View file

@ -18,6 +18,8 @@
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include "30-test.i"
struct baz {
@ -55,13 +57,15 @@ add2 (void *ptab)
struct foo *hash_ident[10];
#if !defined (__TINYC__)
void *
memset (void *s, int c, int n)
memset (void *s, int c, size_t n)
{
char *p = s;
while (n--) *p++ = c;
return s;
}
#endif
int
test ()

View file

@ -61,9 +61,9 @@ test ()
memcpy (&b[4], c, 2 * sizeof (int));
eputs ("b[4]:"); eputs (itoa (b[4])); eputs ("\n");
if (b[4] != 201) return 5;
if (b[4] != 201) return 7;
eputs ("b[5]:"); eputs (itoa (b[5])); eputs ("\n");
if (b[5] != 211) return 6;
if (b[5] != 211) return 8;
return 0;
}

View file

@ -24,12 +24,14 @@
#include <stdlib.h>
#include <string.h>
#if !defined ( __TINYC__)
unsigned long long
strtoull (char const *p, char **end, int base)
{
*end = p;
return abtoi (end, base);
}
#endif
int
test ()