! Test sizeof fixed with typedefs in cdefs.h
!
! @Author:  Neon Ngo
! @Version: $Id: test_cdefs.mm,v 1.4 2010/12/09 16:10:05 ntn Exp $
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE
  switch DEBUG       debug    GET DEF=FALSE SDEF=TRUE

  invoke nativetypesizes nxm.sys.test.test_cdefs.getSizeofNativeTypes()
  if nativetypesizes.native isFalse then
    info "^reg.main.name: Skipping sizeof fixed width Midas typedefs test (native code not enabled/available)."
  else
    if debug isTrue then
      res nativetypesizes
    endif
    calc L:inbits nativetypesizes.size_t 8 *
    info "^reg.main.name: sizeof size_t = ^{nativetypesizes.size_t} bytes (^{inbits}-bits)"
    assert/text="^reg.main.name: sizeof int_1  == 1" 1 eq nativetypesizes.int_1
    assert/text="^reg.main.name: sizeof int_u1 == 1" 1 eq nativetypesizes.int_u1
    assert/text="^reg.main.name: sizeof int_2  == 2" 2 eq nativetypesizes.int_2
    assert/text="^reg.main.name: sizeof int_u2 == 2" 2 eq nativetypesizes.int_u2
    assert/text="^reg.main.name: sizeof int_4  == 4" 4 eq nativetypesizes.int_4
    assert/text="^reg.main.name: sizeof int_u4 == 4" 4 eq nativetypesizes.int_u4
    assert/text="^reg.main.name: sizeof int_8  == 8" 8 eq nativetypesizes.int_8
    assert/text="^reg.main.name: sizeof int_u8 == 8" 8 eq nativetypesizes.int_u8
    assert/text="^reg.main.name: sizeof real_4 == 4" 4 eq nativetypesizes.real_4
    assert/text="^reg.main.name: sizeof real_8 == 8" 8 eq nativetypesizes.real_8
    assert/text="^reg.main.name: sizeof bool_1 == 1" 1 eq nativetypesizes.bool_1
    assert/text="^reg.main.name: sizeof bool_2 == 2" 2 eq nativetypesizes.bool_2
    assert/text="^reg.main.name: sizeof bool_4 == 4" 4 eq nativetypesizes.bool_4
  endif

endmacro
