2017-07-20 08:05:48 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* Mes --- Maxwell Equations of Software
|
2018-05-05 10:30:06 +00:00
|
|
|
* Copyright © 2017 Jan 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"
|
|
|
|
|
2018-05-10 10:40:07 +00:00
|
|
|
char *g_hello = "hello";
|
2017-07-20 08:05:48 +00:00
|
|
|
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 ()
|
|
|
|
{
|
2018-05-10 10:40:07 +00:00
|
|
|
if (*g_hello != 'h') return 1;
|
|
|
|
if (g_hello[0] != 'h') return 2;
|
|
|
|
if (g_chars[0] != 'X') return 3;
|
|
|
|
if (*g_chars != 'X') return 4;
|
|
|
|
|
2017-07-20 08:05:48 +00:00
|
|
|
g_arena[0] = 'A';
|
2018-05-10 10:40:07 +00:00
|
|
|
if (*g_chars != 'A') return 5;
|
2017-07-20 08:05:48 +00:00
|
|
|
char *x = g_arena;
|
2018-05-10 10:40:07 +00:00
|
|
|
if (*x++ != 'A') return 5;
|
2017-07-20 08:05:48 +00:00
|
|
|
*x++ = 'C';
|
2018-05-10 10:40:07 +00:00
|
|
|
if (g_chars[1] != 'C') return 7;
|
|
|
|
if (g_chars[2] != 'X') return 8;
|
2017-08-27 14:58:56 +00:00
|
|
|
*--x = 'X';
|
2018-05-10 10:40:07 +00:00
|
|
|
if (g_chars[1] != 'X') return 9;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char **pp = &x;
|
2018-05-10 10:40:07 +00:00
|
|
|
if (**pp != 'X') return 10;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char *p = *pp;
|
2018-05-10 10:40:07 +00:00
|
|
|
if (*p != 'X') return 11;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char ***ppp = &pp;
|
2018-05-10 10:40:07 +00:00
|
|
|
if (***ppp != 'X') return 12;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
|
|
|
char **pp2 = *ppp;
|
2018-05-10 10:40:07 +00:00
|
|
|
if (**pp2 != 'X') return 13;
|
2017-07-25 09:11:26 +00:00
|
|
|
|
2017-07-25 15:01:37 +00:00
|
|
|
struct foo *f = 0;
|
2018-05-10 10:40:07 +00:00
|
|
|
if (f) return 14;
|
|
|
|
if (file) return 15;
|
2017-07-25 15:01:37 +00:00
|
|
|
|
2017-07-20 08:05:48 +00:00
|
|
|
return 0;
|
|
|
|
}
|