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;
-
- // if (strcmp (g_hello, g_hello3))
- // return 2;
-
- // char hello[] =
- // "hello\n"
- // "world\n"
- // ;
-
- // char *hello2 =
- // "hello\n"
- // "world\n"
- // ;
-
- // 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',
- // }
- // ;
-
- // oputs (hello3);
- // if (strcmp (hello, hello3))
- // return 4;
-
- // if (g_hello_int[0])
- // return 5;
+ 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;
+
+ char hello[] =
+ "hello\n"
+ "world\n"
+ ;
+
+ char *hello2 =
+ "hello\n"
+ "world\n"
+ ;
+
+ 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',
+ }
+ ;
+
+ oputs (hello3);
+ if (strcmp (hello, hello3))
+ return 4;
+
+ 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;
}
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 ("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 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;
+ 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 ("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 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;
return 0;
}