From 06a85ca9e033f7e6f10599fc2b2192aa9fe048c3 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 25 Jun 2019 20:11:57 +0200 Subject: [PATCH] test: Oops, uncomment some commented-out tests. * lib/tests/scaffold/55-char-array.c: Uncomment. * lib/tests/scaffold/72-typedef-struct-def.c: Likewise. --- lib/tests/scaffold/55-char-array.c | 72 +++++++++++----------- lib/tests/scaffold/72-typedef-struct-def.c | 48 +++++++-------- 2 files changed, 59 insertions(+), 61 deletions(-) diff --git a/lib/tests/scaffold/55-char-array.c b/lib/tests/scaffold/55-char-array.c index 41b327e5..2423d400 100644 --- a/lib/tests/scaffold/55-char-array.c +++ b/lib/tests/scaffold/55-char-array.c @@ -35,54 +35,54 @@ int g_hello_int[] = { 0, 1, 2, 3, 4, 5 }; int main (int argc) { - // oputs ("0:"); oputs (g_hello); oputs ("\n"); - // oputs ("2:"); oputs (g_hello2); oputs ("\n"); - // oputs ("3:"); oputs (g_hello3); oputs ("\n"); - // if (strcmp (g_hello, g_hello2)) - // return 1; + oputs ("0:"); oputs (g_hello); oputs ("\n"); + oputs ("2:"); oputs (g_hello2); oputs ("\n"); + oputs ("3:"); oputs (g_hello3); oputs ("\n"); + if (strcmp (g_hello, g_hello2)) + return 1; - // if (strcmp (g_hello, g_hello3)) - // return 2; + if (strcmp (g_hello, g_hello3)) + return 2; - // char hello[] = - // "hello\n" - // "world\n" - // ; + char hello[] = + "hello\n" + "world\n" + ; - // char *hello2 = - // "hello\n" - // "world\n" - // ; + char *hello2 = + "hello\n" + "world\n" + ; - // oputs (hello); - // oputs (hello2); - // if (strcmp (hello, hello2)) - // return 3; + oputs (hello); + oputs (hello2); + if (strcmp (hello, hello2)) + return 3; - // char hello3[] = - // { - // 'h', 'e', 'l', 'l', 'o', '\n', - // 'w', 'o', 'r', 'l', 'd', '\n', - // '\0', - // } - // ; + char hello3[] = + { + 'h', 'e', 'l', 'l', 'o', '\n', + 'w', 'o', 'r', 'l', 'd', '\n', + '\0', + } + ; - // oputs (hello3); - // if (strcmp (hello, hello3)) - // return 4; + oputs (hello3); + if (strcmp (hello, hello3)) + return 4; - // if (g_hello_int[0]) - // return 5; + if (g_hello_int[0]) + return 5; if (g_hello_int[1] != 1) return 6; - // int hello_int[] = {0, 1, 2, 3, 4, 5}; - // if (hello_int[0]) - // return 7; + int hello_int[] = {0, 1, 2, 3, 4, 5}; + if (hello_int[0]) + return 7; - // if (hello_int[1] != 1) - // return 8; + if (hello_int[1] != 1) + return 8; return 0; } diff --git a/lib/tests/scaffold/72-typedef-struct-def.c b/lib/tests/scaffold/72-typedef-struct-def.c index 1ef83c0a..056520bd 100644 --- a/lib/tests/scaffold/72-typedef-struct-def.c +++ b/lib/tests/scaffold/72-typedef-struct-def.c @@ -101,36 +101,34 @@ main () return 6; #endif + printf ("(*pp)->b.i=%d\n", (*pp)->f.i); + if ((*pp)->f.i != 2) return 7; + if (baz[0].i != 1) return 8; + printf ("baz[0].f.i=%d\n", baz[0].f.i); + if (baz[0].f.i != 2) return 9; - // printf ("(*pp)->b.i=%d\n", (*pp)->f.i); - // if ((*pp)->f.i != 2) return 7; + printf ("baz[1].i=%d\n", baz[1].i); + if (baz[1].i != 4) return 10; + printf ("baz[1].f.i=%d\n", baz[1].f.i); + if (baz[1].f.i != 5) return 11; - // if (baz[0].i != 1) return 8; - // printf ("baz[0].f.i=%d\n", baz[0].f.i); - // if (baz[0].f.i != 2) return 9; + bar one = {0}; + printf ("one.i\n", one.i); + if (one.i != 0) return 12; + printf ("one.f.i\n", one.f.i); + if (one.f.i != 0) return 13; - // printf ("baz[1].i=%d\n", baz[1].i); - // if (baz[1].i != 4) return 10; - // printf ("baz[1].f.i=%d\n", baz[1].f.i); - // if (baz[1].f.i != 5) return 11; + bar b0 = {2}; + struct foo f0 = {0}; + struct foo *pf = &f0; + list[0] = &b0; + list[0]->p = pf; - // bar one = {0}; - // printf ("one.i\n", one.i); - // if (one.i != 0) return 12; - // printf ("one.f.i\n", one.f.i); - // if (one.f.i != 0) return 13; - - // bar b0 = {2}; - // struct foo f0 = {0}; - // struct foo *pf = &f0; - // list[0] = &b0; - // list[0]->p = pf; - - // eputs ("b0.i="); eputs (itoa (b0.i)); eputs ("\n"); - // if (b0.i != 2) return 14; - // eputs ("b0.p->i="); eputs (itoa (b0.p->i)); eputs ("\n"); - // if (b0.p->i != 0) return 15; + eputs ("b0.i="); eputs (itoa (b0.i)); eputs ("\n"); + if (b0.i != 2) return 14; + eputs ("b0.p->i="); eputs (itoa (b0.p->i)); eputs ("\n"); + if (b0.p->i != 0) return 15; return 0; }