mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 23:36:00 +02:00
Initial checkin
This commit is contained in:
parent
c74712dad9
commit
078564ac9e
3242 changed files with 1616395 additions and 0 deletions
5
IDE/Tests/SlotTest/BeefProj.toml
Normal file
5
IDE/Tests/SlotTest/BeefProj.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "IDETest"
|
||||
StartupObject = "IDETest.Program"
|
7
IDE/Tests/SlotTest/BeefSpace.toml
Normal file
7
IDE/Tests/SlotTest/BeefSpace.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
Projects = {IDETest = {Path = "."}}
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "IDETest"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
IntermediateType = "ObjectAndIRCode"
|
13
IDE/Tests/SlotTest/scripts/SlotTest001.txt
Normal file
13
IDE/Tests/SlotTest/scripts/SlotTest001.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
ShowFile("src/SlotTest001.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepOver()
|
||||
AssertEvalEquals("val0", "931")
|
||||
|
||||
Continue()
|
||||
ToggleCommentAt("ClassA_IFace0")
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
AssertEvalEquals("val0", "4321931")
|
10
IDE/Tests/SlotTest/src/Program.bf
Normal file
10
IDE/Tests/SlotTest/src/Program.bf
Normal file
|
@ -0,0 +1,10 @@
|
|||
namespace IDETest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
SlotTest001.Test();
|
||||
}
|
||||
}
|
||||
}
|
90
IDE/Tests/SlotTest/src/SlotTest001.bf
Normal file
90
IDE/Tests/SlotTest/src/SlotTest001.bf
Normal file
|
@ -0,0 +1,90 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class SlotTest001
|
||||
{
|
||||
interface ITestA
|
||||
{
|
||||
int MethodA();
|
||||
}
|
||||
|
||||
interface ITestB
|
||||
{
|
||||
int MethodB();
|
||||
}
|
||||
|
||||
interface ITestC
|
||||
{
|
||||
int MethodC();
|
||||
}
|
||||
|
||||
interface ITestD
|
||||
{
|
||||
int MethodD();
|
||||
}
|
||||
|
||||
class ClassA
|
||||
/*ClassA_IFace0
|
||||
: ITestA, ITestB, ITestC, ITestD
|
||||
*/
|
||||
//: ITestA, ITestB, ITestC, ITestD
|
||||
{
|
||||
public virtual int VirtA()
|
||||
{
|
||||
return 931;
|
||||
}
|
||||
|
||||
public int MethodA()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int MethodB()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int MethodC()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public int MethodD()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
public static int TestA()
|
||||
{
|
||||
ClassA ca = scope .();
|
||||
int val = ca.VirtA();
|
||||
Test.Assert(val == 931);
|
||||
|
||||
Object obj = ca;
|
||||
|
||||
var ifaceA = obj as ITestA;
|
||||
if (ifaceA != null)
|
||||
val += ifaceA.MethodA() * 1000;
|
||||
var ifaceB = obj as ITestB;
|
||||
if (ifaceB != null)
|
||||
val += ifaceB.MethodB() * 10000;
|
||||
var ifaceC = obj as ITestC;
|
||||
if (ifaceC != null)
|
||||
val += ifaceC.MethodC() * 100000;
|
||||
var ifaceD = obj as ITestD;
|
||||
if (ifaceD != null)
|
||||
val += ifaceD.MethodD() * 1000000;
|
||||
return val;
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
int val0 = TestA();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue