-- version control marker $Id: cg10byte.occ,v 1.1 1995/10/10 13:02:40 djb1 Exp $
PROC do.BYTE.and.BOOL ()
  SEQ
    BYTE b :
    SEQ
      b := 85(BYTE)
      --{{{  output message
      title ("BYTE operations")
      --}}} 
      --{{{  variables for conversion tests
      INT i :
      INT64 i64 :
      INT32 i32 :
      INT16 i16 :
      BYTE byte :
      BOOL bool :
      --}}} 
      --{{{  check conversions
      SEQ
        i64 := INT64 b
        check.INT64 (i64, INT64 85(BYTE), "BYTE-01")
        i32 := INT32 b
        check.INT32 (i32, INT32 85(BYTE), "BYTE-02")
        i16 := INT16 b
        check.INT16 (i16, INT16 85(BYTE), "BYTE-03")
        byte := BYTE b
        check.BYTE (byte, BYTE 85(BYTE), "BYTE-04")
        i := INT b
        check.INT (i, INT 85(BYTE), "BYTE-04a")
        b := 1(BYTE)
        bool := BOOL b
        check.BOOL (bool, BOOL 1(BYTE), "BYTE-05")
      --}}} 
      --{{{  check constant folding
      PROC constant.fold.bytes()
        VAL x1 IS 000(BYTE) :
        VAL x2 IS 127(BYTE) :
        VAL x3 IS 128(BYTE) :
        VAL x4 IS 255(BYTE) :
        BYTE b1, b2, b3, b4 :
        BOOL b :
        BYTE FUNCTION copy(VAL BYTE b) IS b :
        SEQ
          b1, b2, b3, b4 := copy(x1), copy(x2), copy(x3), copy(x4)
      
          --{{{  check a value against itself  BYTE-100 - BYTE-199
          b := b1 = b1
          check.BOOL(b,        TRUE,  "BYTE-100")
          check.BOOL(x1 = x1,  TRUE,  "BYTE-101")
          b := b1 <> b1
          check.BOOL(b,        FALSE, "BYTE-102")
          check.BOOL(x1 <> x1, FALSE, "BYTE-103")
          b := b1 < b1
          check.BOOL(b,        FALSE, "BYTE-104")
          check.BOOL(x1 < x1,  FALSE, "BYTE-105")
          b := b1 > b1
          check.BOOL(b,        FALSE, "BYTE-106")
          check.BOOL(x1 > x1,  FALSE, "BYTE-107")
          b := b1 <= b1
          check.BOOL(b,        TRUE,  "BYTE-108")
          check.BOOL(x1 <= x1, TRUE,  "BYTE-109")
          b := b1 >= b1
          check.BOOL(b,        TRUE,  "BYTE-110")
          check.BOOL(x1 >= x1, TRUE,  "BYTE-111")
          --}}}
      
          --{{{  check for =     BYTE-200 - BYTE-399
          b := b1 = b2
          check.BOOL(b,        FALSE, "BYTE-200")
          check.BOOL(x1 = x2,  FALSE, "BYTE-201")
          b := b1 = b3
          check.BOOL(b,        FALSE, "BYTE-202")
          check.BOOL(x1 = x3,  FALSE, "BYTE-203")
          b := b1 = b4
          check.BOOL(b,        FALSE, "BYTE-204")
          check.BOOL(x1 = x4,  FALSE, "BYTE-205")
          b := b2 = b3
          check.BOOL(b,        FALSE, "BYTE-206")
          check.BOOL(x2 = x3,  FALSE, "BYTE-207")
          b := b2 = b4
          check.BOOL(b,        FALSE, "BYTE-208")
          check.BOOL(x2 = x4,  FALSE, "BYTE-209")
          b := b3 = b4
          check.BOOL(b,        FALSE, "BYTE-210")
          check.BOOL(x3 = x4,  FALSE, "BYTE-211")
          --}}}
      
          --{{{  check for <>    BYTE-300 - BYTE-399
          b := b1 <> b2
          check.BOOL(b,        TRUE,  "BYTE-300")
          check.BOOL(x1 <> x2, TRUE,  "BYTE-301")
          b := b1 <> b3
          check.BOOL(b,        TRUE,  "BYTE-302")
          check.BOOL(x1 <> x3, TRUE,  "BYTE-303")
          b := b1 <> b4
          check.BOOL(b,        TRUE,  "BYTE-304")
          check.BOOL(x1 <> x4, TRUE,  "BYTE-305")
          b := b2 <> b3
          check.BOOL(b,        TRUE,  "BYTE-306")
          check.BOOL(x2 <> x3, TRUE,  "BYTE-307")
          b := b2 <> b4
          check.BOOL(b,        TRUE,  "BYTE-308")
          check.BOOL(x2 <> x4, TRUE,  "BYTE-309")
          b := b3 <> b4
          check.BOOL(b,        TRUE,  "BYTE-310")
          check.BOOL(x3 <> x4, TRUE,  "BYTE-311")
          --}}}
      
          --{{{  check for <     BYTE-400 - BYTE-499
          b := b1 < b2
          check.BOOL(b,        TRUE,  "BYTE-400")
          check.BOOL(x1 < x2,  TRUE,  "BYTE-401")
          b := b1 < b3
          check.BOOL(b,        TRUE,  "BYTE-402")
          check.BOOL(x1 < x3,  TRUE,  "BYTE-403")
          b := b1 < b4
          check.BOOL(b,        TRUE,  "BYTE-404")
          check.BOOL(x1 < x4,  TRUE,  "BYTE-405")
          b := b2 < b3
          check.BOOL(b,        TRUE,  "BYTE-406")
          check.BOOL(x2 < x3,  TRUE,  "BYTE-407")
          b := b2 < b4
          check.BOOL(b,        TRUE,  "BYTE-408")
          check.BOOL(x2 < x4,  TRUE,  "BYTE-409")
          b := b3 < b4
          check.BOOL(b,        TRUE,  "BYTE-410")
          check.BOOL(x3 < x4,  TRUE,  "BYTE-411")
          --}}}
      
          --{{{  check for >     BYTE-500 - BYTE-599
          b := b1 > b2
          check.BOOL(b,        FALSE, "BYTE-500")
          check.BOOL(x1 > x2,  FALSE, "BYTE-501")
          b := b1 > b3
          check.BOOL(b,        FALSE, "BYTE-502")
          check.BOOL(x1 > x3,  FALSE, "BYTE-503")
          b := b1 > b4
          check.BOOL(b,        FALSE, "BYTE-504")
          check.BOOL(x1 > x4,  FALSE, "BYTE-505")
          b := b2 > b3
          check.BOOL(b,        FALSE, "BYTE-506")
          check.BOOL(x2 > x3,  FALSE, "BYTE-507")
          b := b2 > b4
          check.BOOL(b,        FALSE, "BYTE-508")
          check.BOOL(x2 > x4,  FALSE, "BYTE-509")
          b := b3 > b4
          check.BOOL(b,        FALSE, "BYTE-510")
          check.BOOL(x3 > x4,  FALSE, "BYTE-511")
          --}}}
      
          --{{{  check for <=    BYTE-600 - BYTE-699
          b := b1 <= b2
          check.BOOL(b,        TRUE,  "BYTE-600")
          check.BOOL(x1 <= x2, TRUE,  "BYTE-601")
          b := b1 <= b3
          check.BOOL(b,        TRUE,  "BYTE-602")
          check.BOOL(x1 <= x3, TRUE,  "BYTE-603")
          b := b1 <= b4
          check.BOOL(b,        TRUE,  "BYTE-604")
          check.BOOL(x1 <= x4, TRUE,  "BYTE-605")
          b := b2 <= b3
          check.BOOL(b,        TRUE,  "BYTE-606")
          check.BOOL(x2 <= x3, TRUE,  "BYTE-607")
          b := b2 <= b4
          check.BOOL(b,        TRUE,  "BYTE-608")
          check.BOOL(x2 <= x4, TRUE,  "BYTE-609")
          b := b3 <= b4
          check.BOOL(b,        TRUE,  "BYTE-610")
          check.BOOL(x3 <= x4, TRUE,  "BYTE-611")
          --}}}
      
          --{{{  check for >=    BYTE-700 - BYTE-799
          b := b1 >= b2
          check.BOOL(b,        FALSE, "BYTE-700")
          check.BOOL(x1 >= x2, FALSE, "BYTE-701")
          b := b1 >= b3
          check.BOOL(b,        FALSE, "BYTE-702")
          check.BOOL(x1 >= x3, FALSE, "BYTE-703")
          b := b1 >= b4
          check.BOOL(b,        FALSE, "BYTE-704")
          check.BOOL(x1 >= x4, FALSE, "BYTE-705")
          b := b2 >= b3
          check.BOOL(b,        FALSE, "BYTE-706")
          check.BOOL(x2 >= x3, FALSE, "BYTE-707")
          b := b2 >= b4
          check.BOOL(b,        FALSE, "BYTE-708")
          check.BOOL(x2 >= x4, FALSE, "BYTE-709")
          b := b3 >= b4
          check.BOOL(b,        FALSE, "BYTE-710")
          check.BOOL(x3 >= x4, FALSE, "BYTE-711")
          --}}}
      :
      constant.fold.bytes()
      --}}}
    BOOL b :
    SEQ
      b := BOOL 1
      --{{{  output message
      title ("BOOL operations")
      --}}} 
      --{{{  variables for conversion tests
      INT i :
      INT64 i64 :
      INT32 i32 :
      INT16 i16 :
      BYTE byte :
      BOOL bool :
      --}}} 
      --{{{  conversion tests                    (BOOL-00 to 09)
      SEQ
        i64 := INT64 b
        check.INT64 (i64, INT64 (BOOL 1), "BOOL-01")
        i32 := INT32 b
        check.INT32 (i32, INT32 (BOOL 1), "BOOL-02")
        i16 := INT16 b
        check.INT16 (i16, INT16 (BOOL 1), "BOOL-03")
        byte := BYTE b
        check.BYTE (byte, BYTE (BOOL 1), "BOOL-04")
        i := INT b
        check.INT (i, INT (BOOL 1), "BOOL-04a")
        b := BOOL 1
        bool := BOOL b
        check.BOOL (bool, BOOL (BOOL 1), "BOOL-05")
      --}}} 
:
do.BYTE.and.BOOL ()
