Files
c3c/test/unit/regression/distinct_inline.c3
Christoffer Lerno 5c77c9a754 - Change distinct -> typedef.
- Order of attribute declaration is changed for `alias`.
- Added `LANGUAGE_DEV_VERSION` env constant.
- Rename `anyfault` -> `fault`.
- Changed `fault` -> `faultdef`.
- Added `attrdef` instead of `alias` for attribute aliases.
2025-03-15 20:10:47 +01:00

49 lines
1.3 KiB
Plaintext

module distinct_inline @test;
typedef Foo = inline int;
typedef Bar = inline Foo;
typedef Baz = inline Foo;
typedef Abc = inline Baz;
typedef Def = inline Abc;
typedef Other = inline int;
typedef Other2 = inline Other;
fn void test_binary()
{
assert($typeof((Foo)1 + 1).typeid == Foo.typeid);
assert($typeof((Foo)1 + (Bar)1).typeid == Foo.typeid);
assert($typeof((Baz)1 + (Bar)1).typeid == Foo.typeid);
assert($typeof((Def)1 + (Bar)1).typeid == Foo.typeid);
assert($typeof((Other2)1 + (Def)1).typeid == int.typeid);
}
typedef DistinctInt = inline int;
typedef DistinctUInt = inline uint;
fn void test_comparison()
{
char v_char;
ichar v_ichar;
short v_short;
short v_ushort;
int v_int;
uint v_uint;
long v_long;
ulong v_ulong;
assert((DistinctInt)0 == v_ichar);
assert((DistinctInt)0 == v_char);
assert((DistinctInt)0 == v_short);
assert((DistinctInt)0 == v_ushort);
assert((DistinctInt)0 == v_int);
assert((DistinctInt)0 == v_uint);
assert((DistinctInt)0 == v_long);
assert((DistinctInt)0 == v_ulong);
assert((DistinctUInt)0 == v_ichar);
assert((DistinctUInt)0 == v_char);
assert((DistinctUInt)0 == v_short);
assert((DistinctUInt)0 == v_ushort);
assert((DistinctUInt)0 == v_int);
assert((DistinctUInt)0 == v_uint);
assert((DistinctUInt)0 == v_long);
assert((DistinctUInt)0 == v_ulong);
}