mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 00:20:25 +02:00
Direct auto-prop inc/dec fix
This commit is contained in:
parent
0d7a7e98e4
commit
394a7e0bc5
2 changed files with 37 additions and 1 deletions
|
@ -10,6 +10,8 @@ namespace Tests
|
|||
{
|
||||
public int mA = 111;
|
||||
|
||||
public static int sAutoProp { get; set; }
|
||||
|
||||
public this()
|
||||
{
|
||||
}
|
||||
|
@ -18,6 +20,17 @@ namespace Tests
|
|||
{
|
||||
mA = a;
|
||||
}
|
||||
|
||||
public static void IncAutoProp()
|
||||
{
|
||||
Test.Assert(sAutoProp == 0);
|
||||
int v = ++sAutoProp;
|
||||
Test.Assert(v == 1);
|
||||
Test.Assert(sAutoProp == 1);
|
||||
int v2 = sAutoProp++;
|
||||
Test.Assert(v == 1);
|
||||
Test.Assert(sAutoProp == 2);
|
||||
}
|
||||
}
|
||||
|
||||
struct StructB
|
||||
|
@ -157,6 +170,13 @@ namespace Tests
|
|||
MethodC(ce);
|
||||
Test.Assert(ce.Val == 999);
|
||||
Test.Assert(MethodD(ce) == 999);
|
||||
|
||||
StructA.IncAutoProp();
|
||||
int ap = ++StructA.sAutoProp;
|
||||
Test.Assert(ap == 3);
|
||||
int ap2 = StructA.sAutoProp++;
|
||||
Test.Assert(ap2 == 3);
|
||||
Test.Assert(StructA.sAutoProp == 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue