summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-460444.c
blob: 739eadbf2f5a2c97896162bff8c385ab35046aa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* bug 460444
 */
#include <testfwk.h>

void
testXOR(void)
{
  volatile int p = 5;
  
  if (p ^ 0x60) {
    // Good.
  }
  else {
    FAIL();
  }

  /* Test is to see if it compiles. */
  ASSERT((p^0x60) == 0x65);
  ASSERT((p&0x61) == 0x01);
  ASSERT((p|0x60) == 0x65);

  p = 0x1234;
  if (p ^ 0x5678) {
    // Good.
  }
  else {
    FAIL();
  }

  if (p & 0x4324) {
    // Good
  }
  else {
    FAIL();
  }

  if (p | 0x1279) {
    // Good
  }
  else {
    FAIL();
  }
}

void
testLeftRightXor(void)
{
  volatile int left, right;

  left = 0x123;
  right = 0x8101;

  if (left ^ right) {
    // Good
  }
  else {
    FAIL();
  }

  if (left & right) {
    // Good
  }
  else {
    FAIL();
  }

  if (left | right) {
    // Good
  }
  else {
    FAIL();
  }
}