mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
45 lines
659 B
Beef
45 lines
659 B
Beef
![]() |
using System;
|
||
|
|
||
|
namespace Tests
|
||
|
{
|
||
|
class Initializers
|
||
|
{
|
||
|
struct StructA
|
||
|
{
|
||
|
public int mA = 123;
|
||
|
public int mB;
|
||
|
public int mC;
|
||
|
public int mD;
|
||
|
|
||
|
public int ValC
|
||
|
{
|
||
|
set mut
|
||
|
{
|
||
|
mC = value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void Add(float val, float? val2 = 234) mut
|
||
|
{
|
||
|
mD += (int)val;
|
||
|
mD += (int)val2 * 10;
|
||
|
}
|
||
|
|
||
|
public void Add(int val)
|
||
|
{
|
||
|
Test.FatalError("Shouldn't be called");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public static void TestBasics()
|
||
|
{
|
||
|
StructA sa = .() { mB = 345, ValC = 456, 567.8f, 789};
|
||
|
Test.Assert(sa.mA == 123);
|
||
|
Test.Assert(sa.mB == 345);
|
||
|
Test.Assert(sa.mC == 456);
|
||
|
Test.Assert(sa.mD == 6036);
|
||
|
}
|
||
|
}
|
||
|
}
|