mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 23:56:05 +02:00
Initial checkin
This commit is contained in:
parent
c74712dad9
commit
078564ac9e
3242 changed files with 1616395 additions and 0 deletions
40
IDEHelper/Tests/src/Boxing.bf
Normal file
40
IDEHelper/Tests/src/Boxing.bf
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
class Boxing
|
||||
{
|
||||
interface IFace
|
||||
{
|
||||
int Get() mut;
|
||||
}
|
||||
|
||||
struct Struct : IFace
|
||||
{
|
||||
public int mA = 100;
|
||||
public int mB = 200;
|
||||
|
||||
public int Get() mut
|
||||
{
|
||||
mA += 1000;
|
||||
return mA;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestBasics()
|
||||
{
|
||||
Struct val0 = .();
|
||||
Object obj0 = val0;
|
||||
IFace iface0 = (IFace)obj0;
|
||||
Test.Assert(iface0.Get() == 1100);
|
||||
Test.Assert(val0.mA == 100); // This should copy values
|
||||
|
||||
/*Struct val1 = .();
|
||||
Object obj1 = (Object)(ref val1);
|
||||
IFace iface1 = (IFace)obj1;
|
||||
Test.Assert(iface1.Get() == 1100);
|
||||
Test.Assert(val1.mA == 1100); // This should reference values*/
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue