struct Size7 {
	a i8
	b u8
	c i8
	d i8
	e u8
	f i8
	g u8
}

struct Size28 {
	a int
	b i16
	c int
	d u32
	e i8
	f int
	g int
}

struct StructWithDefault {
	a int = 8
	b int
	c int = 5
}

struct Mutable {
mut:
	a int
}

fn struct_test() {
	a := Size7{1, 2, 3, 4, 5, 6, 7}
	b := a
	assert a.c == 3
	assert b.f == 6
	c := Size28{
		d: 1
		f: 2
		a: 3
		c: 4
	}
	assert c.a == 3
	assert c.f == 2
	assert c.e == 0
	d := StructWithDefault{
		b: 2
		c: 3
	}
	assert d.a == 8
	assert d.b == 2
	assert d.c == 3
	mut e := Mutable{1}
	e.a = 2
	assert e.a == 2
	mut f := &e
	f.a = 3
	assert e.a == 3

	g := &Mutable{2}
	assert g.a == 2
}

type AliasedStruct = Mutable
type AliasedPointer = &Mutable

fn alias_test() {
	mut a := AliasedStruct{1}
	a.a = 2
	assert a.a == 2
	mut b := &a
	b.a = 3
	assert a.a == 3

	c := AliasedPointer{2}
	assert c.a == 2
}

fn init_size28() Size28 {
	return Size28{1, 2, 3, 4, 5, 6, 7}
}
type AliasedSize28 = Size28

fn init_aliased() AliasedSize28 {
	return AliasedSize28{1, 2, 3, 4, 5, 6, 7}
}

fn return_test() {
	a := init_size28()
	assert a.a == 1
	assert a.b == 2
	assert a.c == 3
	assert a.d == 4
	assert a.e == 5
	assert a.f == 6
	assert a.g == 7

	b := init_aliased()
	assert b.a == 1
	assert b.b == 2
	assert b.c == 3
	assert b.d == 4
	assert b.e == 5
	assert b.f == 6
	assert b.g == 7
}

fn main() {
	struct_test()
	return_test()
	alias_test()
}
