test: Add 60-math-modulo.c.
* lib/tests/scaffold/60-math-modulo.c: New test. * build-aux/check-mescc.sh (mes_tests): Add it.
This commit is contained in:
parent
e64d763ccd
commit
dbec0c3845
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
|
||||
# GNU Mes --- Maxwell Equations of Software
|
||||
# Copyright © 2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
# Copyright © 2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
#
|
||||
# This file is part of GNU Mes.
|
||||
#
|
||||
|
@ -117,6 +117,7 @@ lib/tests/scaffold/54-argv.c
|
|||
lib/tests/scaffold/55-char-array.c
|
||||
lib/tests/scaffold/60-math.c
|
||||
lib/tests/scaffold/60-math-itoa.c
|
||||
lib/tests/scaffold/60-math-modulo.c
|
||||
lib/tests/scaffold/61-array.c
|
||||
lib/tests/scaffold/62-array.c
|
||||
lib/tests/scaffold/63-struct.c
|
||||
|
|
79
lib/tests/scaffold/60-math-modulo.c
Normal file
79
lib/tests/scaffold/60-math-modulo.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU 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.
|
||||
*
|
||||
* GNU 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 GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i;
|
||||
|
||||
oputs ("\n");
|
||||
|
||||
oputs ("t: 1 % 2\n");
|
||||
i = 1 % 2;
|
||||
if (i != 1)
|
||||
return 1;
|
||||
|
||||
oputs ("t: 2 % 4\n");
|
||||
i = 2 % 4;
|
||||
if (i != 2)
|
||||
return 2;
|
||||
|
||||
oputs ("t: 3 % 4\n");
|
||||
i = 3 % 4;
|
||||
if (i != 3)
|
||||
return 3;
|
||||
|
||||
oputs ("t: 1 % 256\n");
|
||||
i = 1 % 256;
|
||||
if (i != 1)
|
||||
return 4;
|
||||
|
||||
unsigned u;
|
||||
|
||||
oputs ("\n");
|
||||
|
||||
oputs ("t: 1U % 2\n");
|
||||
u = 1 % 2;
|
||||
if (u != 1)
|
||||
return 5;
|
||||
|
||||
oputs ("t: 2U % 4\n");
|
||||
u = 2 % 4;
|
||||
if (u != 2)
|
||||
return 6;
|
||||
|
||||
oputs ("t: 3U % 4\n");
|
||||
u = 3 % 4;
|
||||
if (u != 3)
|
||||
return 7;
|
||||
|
||||
oputs ("t: 1U % 256\n");
|
||||
u = 1 % 256;
|
||||
if (u != 1)
|
||||
return 8;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue