tests from Dan

This commit is contained in:
Daniel Kroening 2017-08-10 10:22:24 +02:00
parent e0a6bbd20d
commit 240ae60d1e
4 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
// The result of boolean operators is always an int
STATIC_ASSERT(sizeof(1.0 && 1.0)==sizeof(int));
STATIC_ASSERT(sizeof(1.0 || 1.0)==sizeof(int));
STATIC_ASSERT(sizeof(!1.0)==sizeof(int));
int main()
{
}

View File

@ -0,0 +1,8 @@
KNOWNBUG
main.c
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$

View File

@ -0,0 +1,19 @@
#include <assert.h>
int main(void)
{
enum A { zero, one, two, three } a = two, b = one, c = three;
a <<= b;
assert(a==4);
c += b;
assert(c==4);
enum E { fortytwo=42 } e = fortytwo;
double res;
res = -42.0 + (double) e;
assert ((res >= -0.000005) && (res <= 0.000005));
return 0;
}

View File

@ -0,0 +1,8 @@
KNOWNBUG
main.c
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring