2017-07-20 08:05:48 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2017-07-20 08:05:48 +00:00
|
|
|
*
|
|
|
|
* This file is part of Mes.
|
|
|
|
*
|
|
|
|
* Mes is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* Mes is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "00-test.i"
|
|
|
|
|
|
|
|
char g_arena[4] = "XXX";
|
|
|
|
char *g_chars = g_arena;
|
|
|
|
|
2017-07-25 15:01:37 +00:00
|
|
|
struct foo {
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct foo *file;
|
|
|
|
|
2017-07-20 08:05:48 +00:00
|
|
|
int
|
|
|
|
test ()
|
|
|
|
{
|
|
|
|
if (*g_chars != 'X') return 1;
|
|
|
|
g_arena[0] = 'A';
|
2017-07-25 09:11:26 +00:00
|
|
|
if (*g_chars != 'A') return 2;
|
2017-07-20 08:05:48 +00:00
|
|
|
char *x = g_arena;
|
2017-07-25 09:11:26 +00:00
|
|
|
if (*x++ != 'A') return 3;
|
2017-07-20 08:05:48 +00:00
|
|
|
*x++ = 'C';
|
2017-07-25 09:11:26 +00:00
|
|
|
if (g_chars[1] != 'C') return 4;
|
2017-08-27 14:58:56 +00:00
|
|
|
if (g_chars[2] != 'X') return 5;
|
|
|
|
*--x = 'X';
|
|
|
|
if (g_chars[1] != 'X') return 7;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char **pp = &x;
|
2017-08-27 14:58:56 +00:00
|
|
|
if (**pp != 'X') return 7;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char *p = *pp;
|
2017-08-27 14:58:56 +00:00
|
|
|
if (*p != 'X') return 8;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char ***ppp = &pp;
|
2017-08-27 14:58:56 +00:00
|
|
|
if (***ppp != 'X') return 9;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char **pp2 = *ppp;
|
2017-08-27 14:58:56 +00:00
|
|
|
if (**pp2 != 'X') return 10;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
2017-07-25 15:01:37 +00:00
|
|
|
struct foo *f = 0;
|
2017-08-27 14:58:56 +00:00
|
|
|
if (f) return 11;
|
|
|
|
if (file) return 12;
|
2017-07-25 15:01:37 +00:00
|
|
|
|
2017-07-20 08:05:48 +00:00
|
|
|
return 0;
|
|
|
|
}
|