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/CompileFail001/BeefProj.toml
Normal file
5
IDE/Tests/CompileFail001/BeefProj.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "IDETest"
|
||||
StartupObject = "IDETest.Program"
|
7
IDE/Tests/CompileFail001/BeefSpace.toml
Normal file
7
IDE/Tests/CompileFail001/BeefSpace.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
Projects = {IDETest = {Path = "."}}
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "IDETest"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
IntermediateType = "ObjectAndIRCode"
|
14
IDE/Tests/CompileFail001/scripts/CompileFail.txt
Normal file
14
IDE/Tests/CompileFail001/scripts/CompileFail.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
ShowFile("src/Protection.bf")
|
||||
WaitForResolve()
|
||||
SleepTicks(20)
|
||||
AssertFileErrors()
|
||||
|
||||
ShowFile("src/Cases.bf")
|
||||
WaitForResolve()
|
||||
SleepTicks(20)
|
||||
AssertFileErrors()
|
||||
|
||||
ShowFile("src/LocalVars.bf")
|
||||
WaitForResolve()
|
||||
SleepTicks(20)
|
||||
AssertFileErrors()
|
25
IDE/Tests/CompileFail001/src/Cases.bf
Normal file
25
IDE/Tests/CompileFail001/src/Cases.bf
Normal file
|
@ -0,0 +1,25 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Cases
|
||||
{
|
||||
public void Test()
|
||||
{
|
||||
Result<int> iResult = .Err;
|
||||
|
||||
if ((iResult case .Ok(var val0)) || (true)) //FAIL
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int val1;
|
||||
if ((true) || (iResult case .Ok(out val1)))
|
||||
{
|
||||
int a = val1; //FAIL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
179
IDE/Tests/CompileFail001/src/LocalVars.bf
Normal file
179
IDE/Tests/CompileFail001/src/LocalVars.bf
Normal file
|
@ -0,0 +1,179 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class LocalVars
|
||||
{
|
||||
public void Switch1()
|
||||
{
|
||||
int val;
|
||||
|
||||
Result<int> iResult = .Ok(123);
|
||||
switch (iResult)
|
||||
{
|
||||
case .Ok(out val):
|
||||
case .Err:
|
||||
}
|
||||
|
||||
int a = val; //FAIL
|
||||
}
|
||||
|
||||
public void Switch2()
|
||||
{
|
||||
int val;
|
||||
|
||||
Result<int> iResult = .Ok(123);
|
||||
switch (iResult)
|
||||
{
|
||||
case .Ok(out val):
|
||||
case .Err: val = 1;
|
||||
}
|
||||
|
||||
int a = val;
|
||||
}
|
||||
|
||||
public void Switch3()
|
||||
{
|
||||
int val;
|
||||
|
||||
Result<int> iResult = .Ok(123);
|
||||
switch (iResult)
|
||||
{
|
||||
case .Ok(out val):
|
||||
case .Err: return;
|
||||
}
|
||||
|
||||
int a = val;
|
||||
}
|
||||
|
||||
public void Switch4()
|
||||
{
|
||||
int a = 1;
|
||||
int b;
|
||||
|
||||
switch (a)
|
||||
{
|
||||
case 1:
|
||||
b = 1;
|
||||
case 2:
|
||||
case 3:
|
||||
fallthrough;
|
||||
case 4:
|
||||
b = 2;
|
||||
default:
|
||||
b = 3;
|
||||
}
|
||||
|
||||
int c = b; //FAIL
|
||||
}
|
||||
|
||||
public void Switch5()
|
||||
{
|
||||
int a = 1;
|
||||
int b;
|
||||
|
||||
switch (a)
|
||||
{
|
||||
case 1:
|
||||
b = 1;
|
||||
case 2:
|
||||
fallthrough;
|
||||
case 3:
|
||||
fallthrough;
|
||||
case 4:
|
||||
b = 2;
|
||||
default:
|
||||
b = 3;
|
||||
}
|
||||
|
||||
int c = b;
|
||||
}
|
||||
|
||||
public void While1()
|
||||
{
|
||||
int a = 1;
|
||||
int b;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (a == 2)
|
||||
break;
|
||||
b = 2;
|
||||
}
|
||||
|
||||
int c = b; //FAIL
|
||||
}
|
||||
|
||||
public void While2()
|
||||
{
|
||||
int a = 1;
|
||||
int b;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (a == 2)
|
||||
return;
|
||||
b = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
int c = b;
|
||||
}
|
||||
|
||||
public void While3()
|
||||
{
|
||||
int a = 1;
|
||||
int b;
|
||||
|
||||
while (a == 1)
|
||||
{
|
||||
if (a == 2)
|
||||
return;
|
||||
b = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
int c = b; //FAIL
|
||||
}
|
||||
|
||||
public void While4()
|
||||
{
|
||||
for (int i < 2)
|
||||
{
|
||||
int a = 1;
|
||||
int b;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (a == 2)
|
||||
return;
|
||||
b = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
int c = b;
|
||||
}
|
||||
}
|
||||
|
||||
public void While5()
|
||||
{
|
||||
for (int i < 2)
|
||||
{
|
||||
int a = 1;
|
||||
int b;
|
||||
|
||||
while (a == 1)
|
||||
{
|
||||
if (a == 2)
|
||||
return;
|
||||
b = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
int c = b; //FAIL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
257
IDE/Tests/CompileFail001/src/Protection.bf
Normal file
257
IDE/Tests/CompileFail001/src/Protection.bf
Normal file
|
@ -0,0 +1,257 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
class Protection
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
private int mAPriv;
|
||||
protected int mAProt;
|
||||
|
||||
private this(int a)
|
||||
{
|
||||
}
|
||||
|
||||
protected this()
|
||||
{
|
||||
}
|
||||
|
||||
private void MethodA(int a)
|
||||
{
|
||||
}
|
||||
|
||||
protected void MethodA(float b)
|
||||
{
|
||||
}
|
||||
|
||||
class InnerA1
|
||||
{
|
||||
public void Method1(ClassA ca)
|
||||
{
|
||||
var ca2 = new ClassA();
|
||||
ca.mAPriv = 1;
|
||||
ca.mAProt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void PrivA()
|
||||
{
|
||||
}
|
||||
|
||||
protected void ProtA()
|
||||
{
|
||||
}
|
||||
|
||||
public mixin GetPriv()
|
||||
{
|
||||
mAPriv
|
||||
}
|
||||
}
|
||||
|
||||
class ClassB : ClassA
|
||||
{
|
||||
private int mBPriv;
|
||||
protected int mBProt;
|
||||
|
||||
public this() : base()
|
||||
{
|
||||
MethodA(1);
|
||||
}
|
||||
|
||||
public this(int a) : base(123) //FAIL
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void PrivB()
|
||||
{
|
||||
var ca = new ClassA(); //FAIL
|
||||
base.PrivA(); //FAIL
|
||||
ca.GetPriv!();
|
||||
}
|
||||
|
||||
protected void ProtB()
|
||||
{
|
||||
base.ProtA();
|
||||
}
|
||||
|
||||
public class InnerBa
|
||||
{
|
||||
public void MethodIBa1(ClassA ca)
|
||||
{
|
||||
var ca2 = new ClassA(); //FAIL
|
||||
ca.mAPriv = 1; //FAIL
|
||||
ca.mAProt = 1; //FAIL
|
||||
ca.[Friend]mAPriv = 1;
|
||||
}
|
||||
|
||||
public void MethodIBa2(ClassB cb)
|
||||
{
|
||||
cb.mAPriv = 1; //FAIL
|
||||
cb.mAProt = 1;
|
||||
cb.mBPriv = 1;
|
||||
cb.mBProt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void Method1(ClassA ca)
|
||||
{
|
||||
ca.mAPriv = 1; //FAIL
|
||||
ca.mAProt = 1; //FAIL
|
||||
mAPriv = 1; //FAIL
|
||||
mAProt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassQ : ClassB.InnerBa
|
||||
{
|
||||
public void MethodQ3(ClassA ca)
|
||||
{
|
||||
ca.mAProt = 123; //FAIL
|
||||
ca.mAPriv = 1; //FAIL
|
||||
}
|
||||
|
||||
public void MethodQ4(ClassB cb)
|
||||
{
|
||||
cb.mAProt = 123; //FAIL
|
||||
cb.mAPriv = 1; //FAIL
|
||||
}
|
||||
}
|
||||
|
||||
class ClassI<T>
|
||||
{
|
||||
private int mPrivI;
|
||||
protected int mProtI;
|
||||
|
||||
private void PrivI()
|
||||
{
|
||||
}
|
||||
|
||||
protected void ProtI()
|
||||
{
|
||||
}
|
||||
|
||||
public void Method1(ClassI<T> val)
|
||||
{
|
||||
val.mPrivI = 1;
|
||||
val.mProtI = 1;
|
||||
val.PrivI();
|
||||
val.ProtI();
|
||||
mPrivI = 1;
|
||||
mProtI = 2;
|
||||
PrivI();
|
||||
ProtI();
|
||||
}
|
||||
|
||||
public void Method2<T2>(ClassI<T2> val)
|
||||
{
|
||||
val.mPrivI = 1;
|
||||
val.mProtI = 1;
|
||||
val.PrivI();
|
||||
val.ProtI();
|
||||
mPrivI = 1;
|
||||
mProtI = 2;
|
||||
PrivI();
|
||||
ProtI();
|
||||
}
|
||||
|
||||
class InnerI
|
||||
{
|
||||
public void Method1(ClassI<T> val)
|
||||
{
|
||||
val.mPrivI = 1;
|
||||
val.PrivI();
|
||||
}
|
||||
|
||||
public void Method2<T2>(ClassI<T2> val)
|
||||
{
|
||||
val.mPrivI = 1;
|
||||
val.PrivI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ClassJ<T> : ClassI<T>
|
||||
{
|
||||
public void Method3(ClassI<T> val)
|
||||
{
|
||||
val.mPrivI = 1; //FAIL
|
||||
val.mProtI = 1; //FAIL
|
||||
val.PrivI(); //FAIL
|
||||
val.ProtI(); //FAIL
|
||||
mPrivI = 1; //FAIL
|
||||
mProtI = 2;
|
||||
PrivI(); //FAIL
|
||||
ProtI();
|
||||
}
|
||||
|
||||
public void Method4<T2>(ClassI<T2> val)
|
||||
{
|
||||
val.mPrivI = 1; //FAIL
|
||||
val.mProtI = 1; //FAIL
|
||||
val.PrivI(); //FAIL
|
||||
val.ProtI(); //FAIL
|
||||
mPrivI = 1; //FAIL
|
||||
mProtI = 2;
|
||||
PrivI(); //FAIL
|
||||
ProtI();
|
||||
}
|
||||
}
|
||||
|
||||
class ClassR
|
||||
{
|
||||
public void Test(ClassA ca)
|
||||
{
|
||||
ca.GetPriv!();
|
||||
}
|
||||
}
|
||||
|
||||
class ClassS
|
||||
{
|
||||
private static int sS0;
|
||||
public static int sS1;
|
||||
|
||||
class InnerS
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class InnerS2
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ClassT
|
||||
{
|
||||
private static int sT0;
|
||||
public static int sT1;
|
||||
|
||||
class InnerT : ClassS
|
||||
{
|
||||
class MoreInnerT
|
||||
{
|
||||
class Boop : InnerS //FAIL
|
||||
{
|
||||
public void Use()
|
||||
{
|
||||
sS0 = 123; //FAIL
|
||||
sS1 = 234;
|
||||
|
||||
sT0 = 345;
|
||||
sT1 = 456;
|
||||
}
|
||||
}
|
||||
|
||||
class Zoop : InnerS2
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
IDE/Tests/EmptyTest/dumps/Chrome1.dmp
Normal file
BIN
IDE/Tests/EmptyTest/dumps/Chrome1.dmp
Normal file
Binary file not shown.
BIN
IDE/Tests/EmptyTest/dumps/Chrome2.dmp
Normal file
BIN
IDE/Tests/EmptyTest/dumps/Chrome2.dmp
Normal file
Binary file not shown.
18
IDE/Tests/EmptyTest/scripts/Minidump.txt
Normal file
18
IDE/Tests/EmptyTest/scripts/Minidump.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
SetSymSrvOptions("C:/SymCache", "http://linux.beefy2d.com/symbols\nhttps://msdl.microsoft.com/download/symbols", "TempCache")
|
||||
#SetSymSrvOptions("C:/SymCache", "https://msdl.microsoft.com/download/symbols\nhttps://chromium-browser-symsrv.commondatastorage.googleapis.com", "TempCache")
|
||||
#SetSymSrvOptions("C:/SymCache", "https://msdl.microsoft.com/download/symbols\nhttps://chromium-browser-symsrv.commondatastorage.googleapis.com", "None")
|
||||
|
||||
OpenCrashDump("dumps/Chrome1.dmp")
|
||||
WaitForPaused()
|
||||
|
||||
ClickPanelButton("Run")
|
||||
WaitForPaused()
|
||||
|
||||
AssertLineContains("*zero = 0;")
|
||||
|
||||
SelectCallStackIdx(2)
|
||||
AssertCurrentMethod("chrome_child.dll!content::RenderFrameImpl::OnFailedNavigation(const content::CommonNavigationParams& common_params, const content::RequestNavigationParams& request_params, bool has_stale_copy_in_cache, int error_code)")
|
||||
AssertEvalEquals("error_code", "-300")
|
||||
|
||||
SelectCallStackIdx(15)
|
||||
AssertCurrentMethod("chrome_child.dll!base::internal::InvokeHelper<1,void>::MakeItSo(void (bool)& weak_ptr, const base::WeakPtr<blink::scheduler::TaskQueueManager>&, const bool&)")
|
19
IDE/Tests/EmptyTest/scripts/NewProject01.txt
Normal file
19
IDE/Tests/EmptyTest/scripts/NewProject01.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
DelTree("$(ScriptDir)/../../NewProject01")
|
||||
OpenWorkspace("$(ScriptDir)/../../NewProject01")
|
||||
SaveAll()
|
||||
|
||||
# Create some temporary files that we rename, then make sure we can properly use them
|
||||
CreateFile("$(WorkspaceDir)/src/ClassA2.bf", "class ClassA\r\n{\r\n\tpublic static int GetA()\r\n\t{\r\n\t\treturn 20;\r\n\t}\r\n}")
|
||||
CreateFile("$(WorkspaceDir)/src/Program.bf", "using System;\r\n\r\nnamespace NewProject01\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tpublic static void Main()\r\n\t\t{\r\n\t\t\tint a = ClassA.GetA() + ClassB.GetB();\r\n\t\t}\r\n\t}\r\n}")
|
||||
CreateFile("$(WorkspaceDir)/src/ClassA.txt", "class ClassA\r\n{\r\n\tpublic static int GetA()\r\n\t{\r\n\t\treturn 10;\r\n\t}\r\n}")
|
||||
RenameFile("$(WorkspaceDir)/src/ClassA.txt", "$(WorkspaceDir)/src/ClassA.bf")
|
||||
CreateFile("$(WorkspaceDir)/src/ClassB.txt", "class ClassB\r\n{\r\n\tpublic static int GetB()\r\n\t{\r\n\t\treturn 9;\r\n\t}\r\n}")
|
||||
RenameFile_TempRenameDelete("$(WorkspaceDir)/src/ClassB.txt", "$(WorkspaceDir)/src/ClassB.bf")
|
||||
DeleteFile("$(WorkspaceDir)/src/ClassA2.bf")
|
||||
|
||||
# File race condition
|
||||
Sleep(2000)
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("a", "19")
|
21
IDE/Tests/EmptyTest/scripts/NewProject02.txt
Normal file
21
IDE/Tests/EmptyTest/scripts/NewProject02.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
SetFileWatcherDelay(100)
|
||||
|
||||
DelTree("$(ScriptDir)/../../NewProject02")
|
||||
OpenWorkspace("$(ScriptDir)/../../NewProject02")
|
||||
SaveAll()
|
||||
|
||||
# Create some temporary files that we rename, then make sure we can properly use them
|
||||
CreateFile("$(WorkspaceDir)/src/ClassA2.bf", "class ClassA\r\n{\r\n\tpublic static int GetA()\r\n\t{\r\n\t\treturn 20;\r\n\t}\r\n}")
|
||||
CreateFile("$(WorkspaceDir)/src/Program.bf", "using System;\r\n\r\nnamespace NewProject02\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tpublic static void Main()\r\n\t\t{\r\n\t\t\tint a = ClassA.GetA() + ClassB.GetB();\r\n\t\t}\r\n\t}\r\n}")
|
||||
CreateFile("$(WorkspaceDir)/src/ClassA.txt", "class ClassA\r\n{\r\n\tpublic static int GetA()\r\n\t{\r\n\t\treturn 10;\r\n\t}\r\n}")
|
||||
RenameFile("$(WorkspaceDir)/src/ClassA.txt", "$(WorkspaceDir)/src/ClassA.bf")
|
||||
CreateFile("$(WorkspaceDir)/src/ClassB.txt", "class ClassB\r\n{\r\n\tpublic static int GetB()\r\n\t{\r\n\t\treturn 9;\r\n\t}\r\n}")
|
||||
RenameFile_TempRenameDelete("$(WorkspaceDir)/src/ClassB.txt", "$(WorkspaceDir)/src/ClassB.bf")
|
||||
DeleteFile("$(WorkspaceDir)/src/ClassA2.bf")
|
||||
|
||||
# File race condition
|
||||
Sleep(2000)
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("a", "19")
|
30
IDE/Tests/Rando/BeefProj.toml
Normal file
30
IDE/Tests/Rando/BeefProj.toml
Normal file
|
@ -0,0 +1,30 @@
|
|||
FileVersion = 1
|
||||
Dependencies = {minlib = "*"}
|
||||
|
||||
[Project]
|
||||
Name = "RandoTest"
|
||||
StartupObject = "Program"
|
||||
|
||||
[Configs.Debug.Win32]
|
||||
CLibType = "Static"
|
||||
BeefLibType = "Static"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
CLibType = "Static"
|
||||
BeefLibType = "Static"
|
||||
|
||||
[Configs.Paranoid.Win32]
|
||||
CLibType = "Static"
|
||||
BeefLibType = "Static"
|
||||
|
||||
[Configs.Paranoid.Win64]
|
||||
CLibType = "Static"
|
||||
BeefLibType = "Static"
|
||||
|
||||
[Configs.Test.Win32]
|
||||
CLibType = "Static"
|
||||
BeefLibType = "Static"
|
||||
|
||||
[Configs.Test.Win64]
|
||||
CLibType = "Static"
|
||||
BeefLibType = "Static"
|
5
IDE/Tests/Rando/BeefSpace.toml
Normal file
5
IDE/Tests/Rando/BeefSpace.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
Projects = {RandoTest = {Path = "."}, minlib = {Path = "../../mintest/minlib"}}
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "RandoTest"
|
1
IDE/Tests/Rando/cloc.bat
Normal file
1
IDE/Tests/Rando/cloc.bat
Normal file
|
@ -0,0 +1 @@
|
|||
\bin\cloc . --force-lang="C#",bf
|
32
IDE/Tests/Rando/scripts/Test001.toml
Normal file
32
IDE/Tests/Rando/scripts/Test001.toml
Normal file
|
@ -0,0 +1,32 @@
|
|||
TypeCount = 1500
|
||||
PrimitiveTypeChance = 0.0
|
||||
StructPct = 0.0
|
||||
TypeComplexityPower = 2.0
|
||||
|
||||
#CreateGenericTypePct = 0.3
|
||||
#SpecializedTypePower = 3.0
|
||||
#UnspecializedTypeScalar = 10.0
|
||||
|
||||
CreateGenericTypePct = 0.0
|
||||
SpecializedTypePower = 0.0
|
||||
UnspecializedTypeScalar = 0.0
|
||||
TypeDefPoolPower = 1.1
|
||||
TypeDefPoolOffset = 3.0
|
||||
TypeDefPoolScalar = 15.0
|
||||
|
||||
FieldCountPower = 2.0
|
||||
FieldCountScalar = 12.0
|
||||
FieldStaticPct = 0.2
|
||||
|
||||
VoidReturnPct = 0.6
|
||||
MethodCodeComplexityPower = 2.0
|
||||
MethodLengthScalar = 40
|
||||
MethodCountScalar = 10.0
|
||||
AssignMemberPct = 0.3
|
||||
CreateLocalPct = 0.3
|
||||
|
||||
ParamCountPower = 3.0
|
||||
ParamCountScalar = 5.0
|
||||
|
||||
NewSpacespaceChance = 0.2
|
||||
RootNamespaceChance = 0.1
|
29
IDE/Tests/Rando/scripts/Test002.toml
Normal file
29
IDE/Tests/Rando/scripts/Test002.toml
Normal file
|
@ -0,0 +1,29 @@
|
|||
TypeCount = 1500
|
||||
PrimitiveTypeChance = 0.0
|
||||
StructPct = 0.0
|
||||
TypeComplexityPower = 2.0
|
||||
|
||||
CreateGenericTypePct = 0.3
|
||||
SpecializedTypePower = 3.0
|
||||
UnspecializedTypeScalar = 10.0
|
||||
|
||||
TypeDefPoolPower = 1.1
|
||||
TypeDefPoolOffset = 3.0
|
||||
TypeDefPoolScalar = 15.0
|
||||
|
||||
FieldCountPower = 2.0
|
||||
FieldCountScalar = 12.0
|
||||
FieldStaticPct = 0.2
|
||||
|
||||
VoidReturnPct = 0.6
|
||||
MethodCodeComplexityPower = 2.0
|
||||
MethodLengthScalar = 40
|
||||
MethodCountScalar = 10.0
|
||||
AssignMemberPct = 0.3
|
||||
CreateLocalPct = 0.3
|
||||
|
||||
ParamCountPower = 3.0
|
||||
ParamCountScalar = 5.0
|
||||
|
||||
NewSpacespaceChance = 0.2
|
||||
RootNamespaceChance = 0.1
|
29
IDE/Tests/Rando/scripts/Test003.toml
Normal file
29
IDE/Tests/Rando/scripts/Test003.toml
Normal file
|
@ -0,0 +1,29 @@
|
|||
TypeCount = 12000
|
||||
PrimitiveTypeChance = 0.0
|
||||
StructPct = 0.0
|
||||
TypeComplexityPower = 1.2
|
||||
|
||||
CreateGenericTypePct = 0.3
|
||||
SpecializedTypePower = 3.0
|
||||
UnspecializedTypeScalar = 12.0
|
||||
|
||||
TypeDefPoolPower = 1.1
|
||||
TypeDefPoolOffset = 3.0
|
||||
TypeDefPoolScalar = 15.0
|
||||
|
||||
FieldCountPower = 2.0
|
||||
FieldCountScalar = 12.0
|
||||
FieldStaticPct = 0.2
|
||||
|
||||
VoidReturnPct = 0.6
|
||||
MethodCodeComplexityPower = 2.0
|
||||
MethodLengthScalar = 40
|
||||
MethodCountScalar = 10.0
|
||||
AssignMemberPct = 0.3
|
||||
CreateLocalPct = 0.3
|
||||
|
||||
ParamCountPower = 3.0
|
||||
ParamCountScalar = 5.0
|
||||
|
||||
NewSpacespaceChance = 0.2
|
||||
RootNamespaceChance = 0.1
|
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();
|
||||
}
|
||||
}
|
||||
}
|
9
IDE/Tests/SysMSVCRT/BeefProj.toml
Normal file
9
IDE/Tests/SysMSVCRT/BeefProj.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "SysMSVCRT"
|
||||
StartupObject = "SysMSVCRT.Program"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
CLibType = "SystemMSVCRT"
|
||||
BeefLibType = "Static"
|
5
IDE/Tests/SysMSVCRT/BeefSpace.toml
Normal file
5
IDE/Tests/SysMSVCRT/BeefSpace.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
Projects = {SysMSVCRT = {Path = "."}}
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "SysMSVCRT"
|
12
IDE/Tests/SysMSVCRT/src/Program.bf
Normal file
12
IDE/Tests/SysMSVCRT/src/Program.bf
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace SysMSVCRT
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
return int.Parse(args[0]).GetValueOrDefault() + int.Parse(args[1]).GetValueOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
8
IDE/Tests/Test1/BeefProj.toml
Normal file
8
IDE/Tests/Test1/BeefProj.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "IDETest"
|
||||
StartupObject = "IDETest.Program"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
BeefLibType = "DynamicDebug"
|
12
IDE/Tests/Test1/BeefSpace.toml
Normal file
12
IDE/Tests/Test1/BeefSpace.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
FileVersion = 1
|
||||
Projects = {IDETest = {Path = "."}}
|
||||
Unlocked = ["corlib"]
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "IDETest"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
IntermediateType = "ObjectAndIRCode"
|
||||
|
||||
[Configs.Debug.Win32]
|
||||
IntermediateType = "ObjectAndIRCode"
|
29
IDE/Tests/Test1/scripts/Assembly.txt
Normal file
29
IDE/Tests/Test1/scripts/Assembly.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
# We're testing that we can set a breakpoint on a specific assembly instruction
|
||||
# and that when we re-run, we also stop at that instruction
|
||||
|
||||
#Leak()
|
||||
#Sleep(5000)
|
||||
|
||||
ShowFile("src/Assembly.bf")
|
||||
GotoText("//AssemblyTester_Test")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepInto()
|
||||
ShowDisassemblyAtStack()
|
||||
|
||||
GotoTextSkip("call", 1)
|
||||
AdjustCursor(0, 1)
|
||||
ToggleBreakpoint()
|
||||
CloseCurrentDocument()
|
||||
|
||||
Continue()
|
||||
AssertEvalEquals("a", "2")
|
||||
|
||||
StopRunning()
|
||||
CloseCurrentDocument()
|
||||
|
||||
# Make sure when we re-run that we're still stopping after the second IncVal call
|
||||
RunWithCompiling()
|
||||
Continue()
|
||||
AssertEvalEquals("a", "2")
|
31
IDE/Tests/Test1/scripts/Break.txt
Normal file
31
IDE/Tests/Test1/scripts/Break.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
# This tests that we can manually break a long-executing method and then step in the
|
||||
# correct thread
|
||||
|
||||
ShowFile("src/Break.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
ImmediateEvaluate("Infinite()")
|
||||
nowait Sleep(1000)
|
||||
nowait Break()
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("a", "2")
|
||||
StopRunning()
|
||||
|
||||
# The next section uses assembly and it only works in Og+
|
||||
if (platform != "Win64") Stop()
|
||||
|
||||
RunWithCompiling()
|
||||
ShowDisassemblyAtStack()
|
||||
ImmediateEvaluate("Infinite()")
|
||||
nowait Sleep(1000)
|
||||
nowait Break()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
|
||||
AssertEvalEquals("a", "2")
|
48
IDE/Tests/Test1/scripts/Breakpoints.txt
Normal file
48
IDE/Tests/Test1/scripts/Breakpoints.txt
Normal file
|
@ -0,0 +1,48 @@
|
|||
ShowFile("src/Breakpoints.bf")
|
||||
GotoText("//BreakpointTester_Test")
|
||||
ToggleBreakpoint()
|
||||
|
||||
GotoText("//BreakpointTester_LoopA")
|
||||
ToggleBreakpoint()
|
||||
BreakpointSetHitCountTarget(3, "MultipleOf")
|
||||
BreakpointSetCondition("++b < 10")
|
||||
|
||||
GotoText("//BreakpointTester_Recurse")
|
||||
ToggleBreakpoint()
|
||||
|
||||
GotoText("//Recurse_C")
|
||||
ToggleBreakpoint()
|
||||
BreakpointSetCondition("a == 3")
|
||||
|
||||
RunWithCompiling()
|
||||
|
||||
Continue()
|
||||
AssertEvalEquals("a", "2")
|
||||
AssertEvalEquals("b", "3")
|
||||
|
||||
Continue()
|
||||
AssertEvalEquals("a", "5")
|
||||
AssertEvalEquals("b", "6")
|
||||
|
||||
Continue()
|
||||
Continue()
|
||||
AssertLineContains("Recurse(0)")
|
||||
|
||||
StepInto()
|
||||
AssertLineContains("int b = 234")
|
||||
StepOver()
|
||||
AssertLineContains("int c = 345")
|
||||
StepOver()
|
||||
AssertLineContains("a == 10")
|
||||
AssertEvalEquals("a", "0")
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertLineContains("int c = 345")
|
||||
AssertEvalEquals("a", "3")
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("d", "103")
|
28
IDE/Tests/Test1/scripts/Breakpoints02.txt
Normal file
28
IDE/Tests/Test1/scripts/Breakpoints02.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
# This tests for a bug where stepping onto a breakpoint and then continuing (F5)
|
||||
# would cause us to immediately hit the breakpoint we were already at
|
||||
|
||||
ShowFile("src/Breakpoints02.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
|
||||
GotoText("//MethodA_1")
|
||||
ToggleBreakpoint()
|
||||
GotoText("//MethodA_2")
|
||||
ToggleBreakpoint()
|
||||
|
||||
RunWithCompiling()
|
||||
Continue()
|
||||
AssertEvalEquals("a", "1")
|
||||
StepOver()
|
||||
AssertEvalEquals("a", "2")
|
||||
Continue()
|
||||
AssertEvalEquals("a", "5")
|
||||
|
||||
# The next section uses assembly and it only works in Og+
|
||||
if (platform != "Win64") Stop()
|
||||
|
||||
ShowDisassemblyAtStack()
|
||||
StepOver()
|
||||
AssertEvalEquals("a", "6")
|
||||
Continue()
|
||||
AssertEvalEquals("a", "9")
|
9
IDE/Tests/Test1/scripts/Bug001.txt
Normal file
9
IDE/Tests/Test1/scripts/Bug001.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
# This tests for a bug where 'b' wasn't visible on the very last line of the method
|
||||
|
||||
ShowFile("src/bugs/Bug001.bf")
|
||||
GotoText("//Bug001_DoTest")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
AssertEvalEquals("a", "123")
|
||||
AssertEvalEquals("b", "234")
|
19
IDE/Tests/Test1/scripts/Bug002.txt
Normal file
19
IDE/Tests/Test1/scripts/Bug002.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
# This tests that loop over an array correctly steps over the array accessor
|
||||
|
||||
ShowFile("src/bugs/Bug002.bf")
|
||||
GotoText("//Bug002_DoTest")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepInto()
|
||||
StepOver()
|
||||
AssertEvalEquals("val, na", "\"aaa\"")
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val, na", "\"bbb\"")
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val, na", "\"ccc\"")
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val2", "999")
|
9
IDE/Tests/Test1/scripts/Enums.txt
Normal file
9
IDE/Tests/Test1/scripts/Enums.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
ShowFile("src/Enums.bf")
|
||||
GotoText("//EnumTester_Test")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
AssertEvalEquals("ea", ".B(b:1.2)")
|
||||
AssertEvalEquals("z", "(aa:123, bb:345)")
|
||||
AssertEvalEquals("q", "(a:234, 567, c:999)")
|
||||
AssertEvalEquals("qRef = (4, 5, 6)", "(a:4, 5, c:6)")
|
53
IDE/Tests/Test1/scripts/HotSwap_BaseChange.txt
Normal file
53
IDE/Tests/Test1/scripts/HotSwap_BaseChange.txt
Normal file
|
@ -0,0 +1,53 @@
|
|||
ShowFile("src/HotSwap_BaseChange.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
ToggleCommentAt("ClassC_0")
|
||||
ToggleCommentAt("DoTest0_Body")
|
||||
Compile()
|
||||
|
||||
# DoTest0
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("a0", "100")
|
||||
AssertEvalEquals("a1", "101")
|
||||
AssertEvalEquals("c0", "300")
|
||||
StepOut()
|
||||
|
||||
# DoTest1
|
||||
ToggleCommentAt("ClassC_0")
|
||||
ToggleCommentAt("ClassC_1")
|
||||
ToggleCommentAt("DoTest0_Body")
|
||||
ToggleCommentAt("DoTest1_Body")
|
||||
ToggleCommentAt("DoTest2_Decl")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("b0", "200")
|
||||
AssertEvalEquals("c0", "300")
|
||||
|
||||
# DoTest1
|
||||
ToggleCommentAt("ClassB_MethodB1")
|
||||
ToggleCommentAt("ClassC_1")
|
||||
ToggleCommentAt("ClassC_2")
|
||||
ToggleCommentAt("DoTest2_Body")
|
||||
Compile()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("b0", "200")
|
||||
AssertEvalEquals("c0", "1300")
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("b0", "200")
|
||||
AssertEvalEquals("b1", "201")
|
||||
AssertEvalEquals("c0", "1300")
|
||||
AssertEvalEquals("c1", "1301")
|
13
IDE/Tests/Test1/scripts/HotSwap_BaseChange02.txt
Normal file
13
IDE/Tests/Test1/scripts/HotSwap_BaseChange02.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
ShowFile("src/HotSwap_BaseChange.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
ToggleCommentAt("ClassC_3")
|
||||
ToggleCommentAt("DoTest3_Body")
|
||||
SetExpectError("Too many arguments")
|
||||
Compile()
|
||||
|
||||
ToggleCommentAt("ClassC_3")
|
||||
ToggleCommentAt("ClassC_1")
|
||||
Compile()
|
20
IDE/Tests/Test1/scripts/HotSwap_Breakpoints.txt
Normal file
20
IDE/Tests/Test1/scripts/HotSwap_Breakpoints.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
ShowFile("src/HotSwap.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
GotoText("//*HotTester_Test1")
|
||||
AdjustCursor(0, 1)
|
||||
InsertText("int a0 = 1;\n\t\t\tint b0 = 2;\n\t\t\tint c0 = 3;\n")
|
||||
AdjustCursor(0, -2)
|
||||
ToggleBreakpoint()
|
||||
|
||||
# We want to ensure that breakpoint didn't bind yet
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertLineContains("ht.Test1()")
|
||||
|
||||
# ... but now it does
|
||||
Compile()
|
||||
Continue()
|
||||
AssertLineContains("b0 = 2")
|
19
IDE/Tests/Test1/scripts/HotSwap_Data01.txt
Normal file
19
IDE/Tests/Test1/scripts/HotSwap_Data01.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
ShowFile("src/HotSwap_Data.bf")
|
||||
GotoText("//Test_Test01")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepInto()
|
||||
ToggleCommentAt("StructA_mA2")
|
||||
ToggleCommentAt("Test01_mA2")
|
||||
SetExpectError("data changes")
|
||||
Compile()
|
||||
ExpectError()
|
||||
StepOver()
|
||||
StepOver()
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "101")
|
||||
AssertEvalEquals("sc.mA2", "101")
|
14
IDE/Tests/Test1/scripts/HotSwap_Data02.txt
Normal file
14
IDE/Tests/Test1/scripts/HotSwap_Data02.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
ShowFile("src/HotSwap_Data.bf")
|
||||
GotoText("//Test_Test02")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
ToggleCommentAt("Test_funcPtr")
|
||||
Compile()
|
||||
ToggleCommentAt("Func")
|
||||
ToggleCommentAt("Test_funcPtr")
|
||||
Compile()
|
||||
ToggleCommentAt("StructA_mA2")
|
||||
SetExpectError("data changes")
|
||||
Compile()
|
||||
ExpectError()
|
18
IDE/Tests/Test1/scripts/HotSwap_Data03.txt
Normal file
18
IDE/Tests/Test1/scripts/HotSwap_Data03.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
ShowFile("src/HotSwap_Data.bf")
|
||||
ToggleCommentAt("Test03_delegate")
|
||||
|
||||
GotoText("//Test_Test03")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
ToggleCommentAt("Test03_delegate")
|
||||
Compile()
|
||||
|
||||
# We are rebuilding Func so this should be okay
|
||||
ToggleCommentAt("StructA_mA2")
|
||||
Compile()
|
||||
ToggleCommentAt("Func")
|
||||
ToggleCommentAt("StructA_mA3")
|
||||
SetExpectError("data changes")
|
||||
Compile()
|
||||
ExpectError()
|
23
IDE/Tests/Test1/scripts/HotSwap_Data04.txt
Normal file
23
IDE/Tests/Test1/scripts/HotSwap_Data04.txt
Normal file
|
@ -0,0 +1,23 @@
|
|||
ShowFile("src/HotSwap_Data.bf")
|
||||
GotoText("//Test_Test04")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
# Both of these interface will have the same slot number
|
||||
ToggleCommentAt("ClassC_IFaceB_WithComma")
|
||||
SetExpectError("collision error")
|
||||
Compile()
|
||||
ExpectError()
|
||||
|
||||
# Switching interfaces can work if there are no allocations, but this StepInto DOES have an allocation
|
||||
StepInto()
|
||||
ToggleCommentAt("ClassC_IFaceA")
|
||||
ToggleCommentAt("ClassC_IFaceB_WithComma")
|
||||
ToggleCommentAt("ClassC_IFaceB_WithoutComma")
|
||||
SetExpectError("data changes")
|
||||
Compile()
|
||||
ExpectError()
|
||||
|
||||
# But it should succeeed when were back out in Test() with no allocs
|
||||
StepOut()
|
||||
Compile()
|
50
IDE/Tests/Test1/scripts/HotSwap_Funcs.txt
Normal file
50
IDE/Tests/Test1/scripts/HotSwap_Funcs.txt
Normal file
|
@ -0,0 +1,50 @@
|
|||
ShowFile("src/HotSwap.bf")
|
||||
GotoText("//HotStart_Funcs")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
|
||||
# We're on TestFuncs_Compare now
|
||||
GotoText("//HotTester_TestFuncs_Func_Return")
|
||||
AdjustCursor(0, 1)
|
||||
CursorToLineEnd()
|
||||
AdjustCursor(-1, 0)
|
||||
InsertText("4")
|
||||
|
||||
GotoText("//HotB_MethodA_Return")
|
||||
AdjustCursor(0, 1)
|
||||
CursorToLineEnd()
|
||||
AdjustCursor(-1, 0)
|
||||
InsertText("9")
|
||||
|
||||
Compile()
|
||||
|
||||
GotoText("//TestFuncs_Compare_Calls")
|
||||
RunToCursor()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "209")
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "1234")
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "1234")
|
||||
|
||||
Stop()
|
||||
|
||||
StepOut()
|
||||
StepOut()
|
||||
ToggleCommentAt("HotTester_TestFuncs_Func2")
|
||||
ToggleCommentAt("TestFuncs2_Body")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
ToggleCommentAt("TestFuncs2_Compare_Body")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "444")
|
15
IDE/Tests/Test1/scripts/HotSwap_GetUnused.txt
Normal file
15
IDE/Tests/Test1/scripts/HotSwap_GetUnused.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
ShowFile("src/HotSwap_GetUnused.bf")
|
||||
GotoText("//Test")
|
||||
ToggleBreakpoint()
|
||||
Compile()
|
||||
ToggleCommentAt("DoTest_MethodB")
|
||||
Compile()
|
||||
ToggleCommentAt("DoTest_MethodB")
|
||||
RunWithCompiling()
|
||||
ToggleCommentAt("DoTest_MethodB")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "123")
|
34
IDE/Tests/Test1/scripts/HotSwap_Interfaces.txt
Normal file
34
IDE/Tests/Test1/scripts/HotSwap_Interfaces.txt
Normal file
|
@ -0,0 +1,34 @@
|
|||
# This tests hot adding an unreified interface, hot adding interface methods,
|
||||
# and calling hot-added methods
|
||||
|
||||
ShowFile("src/HotSwap.bf")
|
||||
GotoText("//HotStart_Interfaces")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepOver()
|
||||
AssertEvalEquals("hot.IHotA()", "ERROR:'Unable to find address for method, possibly due to compiler optimizations.'")
|
||||
|
||||
ToggleCommentAt("HotTester_TestIHotA")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "15")
|
||||
AssertEvalEquals("hot.IHotA()", "15")
|
||||
|
||||
ToggleCommentAt("IHot_IHotB")
|
||||
ToggleCommentAt("HotTester_TestIHotB")
|
||||
Compile()
|
||||
|
||||
# Steps out
|
||||
StepOver()
|
||||
|
||||
# We need an extra step for Win32 for stack adjustment...
|
||||
if (platform == "Win32") StepOver()
|
||||
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "16")
|
||||
AssertEvalEquals("hot.IHotB()", "16")
|
14
IDE/Tests/Test1/scripts/HotSwap_Interfaces2.txt
Normal file
14
IDE/Tests/Test1/scripts/HotSwap_Interfaces2.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
ShowFile("src/HotSwap_Interfaces2.bf")
|
||||
GotoText("//Test")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
AssertEvalEquals("v0", "11")
|
||||
|
||||
ToggleCommentAt("IFaceA_Method1")
|
||||
ToggleCommentAt("ClassA_Method1")
|
||||
ToggleCommentAt("Test1_Method1")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
AssertEvalEquals("v1", "22")
|
30
IDE/Tests/Test1/scripts/HotSwap_Reflection.txt
Normal file
30
IDE/Tests/Test1/scripts/HotSwap_Reflection.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
ShowFile("src/HotSwap_Reflection.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("field.mFieldData.mName, na", "\"mA\"")
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertLineContains("GetMyType")
|
||||
|
||||
GotoText("//ClassA_mA")
|
||||
AdjustCursor(-1, 0)
|
||||
InsertText("1")
|
||||
Compile()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("field.mFieldData.mName, na", "\"mA1\"")
|
||||
StepOver()
|
||||
StepOver()
|
||||
|
||||
GotoText("//ClassA_mA")
|
||||
AdjustCursor(-1, 0)
|
||||
InsertText("2")
|
||||
Compile()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("field.mFieldData.mName, na", "\"mA12\"")
|
||||
StepOver()
|
||||
StepOver()
|
37
IDE/Tests/Test1/scripts/HotSwap_TLS.txt
Normal file
37
IDE/Tests/Test1/scripts/HotSwap_TLS.txt
Normal file
|
@ -0,0 +1,37 @@
|
|||
ShowFile("src/HotSwap_TLS.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "3")
|
||||
AssertEvalEquals("ClassA.sTLS0", "3")
|
||||
AssertEvalEquals("sThreadResult", "1")
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("sThreadResult", "2")
|
||||
ToggleCommentAt("ClassA_TLS1")
|
||||
ToggleCommentAt("Inc1_TLS1")
|
||||
Compile()
|
||||
AssertEvalEquals("ClassA.sTLS1", "0")
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "3")
|
||||
AssertEvalEquals("ClassA.sTLS1", "3")
|
||||
AssertEvalEquals("sThreadResult", "1")
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("sThreadResult", "2")
|
64
IDE/Tests/Test1/scripts/HotSwap_Virtual.txt
Normal file
64
IDE/Tests/Test1/scripts/HotSwap_Virtual.txt
Normal file
|
@ -0,0 +1,64 @@
|
|||
# Tests:
|
||||
# Virtual methods being added during hot compiles
|
||||
# Breakpoints being set in both old versions of methods and new versions
|
||||
|
||||
ShowFile("src/HotSwap.bf")
|
||||
GotoText("//HotStart")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
# MethodA
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "20")
|
||||
|
||||
# MethodB
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "11")
|
||||
|
||||
# Hot compile, adding in MethodB
|
||||
ToggleCommentAt("HotB_MethodB")
|
||||
Compile()
|
||||
|
||||
# MethodB - after hot compile
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "21")
|
||||
|
||||
# Modify Test1 end so we can make sure break hits both val setting
|
||||
GotoText("//HotTester_Test1_EndTest")
|
||||
ToggleBreakpoint()
|
||||
AdjustCursor(0, 1)
|
||||
CursorToLineEnd()
|
||||
AdjustCursor(-1, 0)
|
||||
InsertText("6")
|
||||
|
||||
# Hot compile, adding in MethodC, but MethodC is not called yet
|
||||
ToggleCommentAt("HotA_MethodC")
|
||||
ToggleCommentAt("HotB_MethodC")
|
||||
Compile()
|
||||
|
||||
# Hot compile in usage of MethodC
|
||||
ToggleCommentAt("HotTester_Test2")
|
||||
Compile()
|
||||
|
||||
# 'Test2' - calling MethodC after hot compile
|
||||
StepInto()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "22")
|
||||
|
||||
# Continue to HotTester_Test1_EndTest
|
||||
Continue
|
||||
StepOver
|
||||
AssertEvalEquals("val", "99")
|
||||
|
||||
# Continue to new HotTester_Test1_EndTest
|
||||
Continue()
|
||||
Continue()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "996")
|
||||
|
||||
# Test previously-unused MethodE
|
||||
ToggleCommentAt("HotTester_Test3")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "14")
|
39
IDE/Tests/Test1/scripts/HotSwap_VirtualRemap.txt
Normal file
39
IDE/Tests/Test1/scripts/HotSwap_VirtualRemap.txt
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Tests that even when removing an old virtual method, adding a new one, and then
|
||||
# adding back a method with the same name as the old one, we can call this new
|
||||
# method using an old virtual call
|
||||
ShowFile("src/HotSwap.bf")
|
||||
GotoText("//HotStart_VirtualRemap")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
# Turn off MethodB
|
||||
ToggleCommentAt("HotA_MethodB")
|
||||
ToggleCommentAt("HotTester_Test1")
|
||||
ToggleCommentAt("HotTester_TestVirtualRemap_MethodBCall")
|
||||
ToggleCommentAt("HotTester_TestVirtualRemap_MethodBCall_2")
|
||||
Compile()
|
||||
# Make sure we can call the old 'MethodB'
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "11")
|
||||
|
||||
# Turn on MethodC
|
||||
ShowCurrent()
|
||||
ToggleCommentAt("HotA_MethodC")
|
||||
ToggleCommentAt("HotTester_TestVirtualRemap2_MethodCCall")
|
||||
Compile()
|
||||
StepInto()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "12")
|
||||
|
||||
# Turn on MethodB (version 2)
|
||||
ToggleCommentAt("HotA_MethodB_2")
|
||||
ToggleCommentAt("HotTester_TestVirtualRemap_MethodBCall")
|
||||
Compile()
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
# We are running an old version of TestVirtualRemap that used the old virtual slot
|
||||
# number for the MethodB call, but the new MethodB should be mapped to that same
|
||||
# slot because it mangles the same
|
||||
AssertEvalEquals("val", "111")
|
14
IDE/Tests/Test1/scripts/Inline.txt
Normal file
14
IDE/Tests/Test1/scripts/Inline.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
ShowFile("src/Inline.bf")
|
||||
GotoText("//InlineTester")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepInto()
|
||||
AssertEvalEquals("argA", "10")
|
||||
AssertEvalEquals("argB", "2")
|
||||
|
||||
StepOver()
|
||||
AssertEvalEquals("argA", "11")
|
||||
|
||||
StepOut()
|
||||
AssertEvalEquals("c", "13")
|
16
IDE/Tests/Test1/scripts/Lambdas.txt
Normal file
16
IDE/Tests/Test1/scripts/Lambdas.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
ShowFile("src/Lambdas.bf")
|
||||
GotoText("//LambdaTest_Test1")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepInto()
|
||||
|
||||
AssertEvalEquals("argA1", "99")
|
||||
AssertEvalEquals("outerVar", "88")
|
||||
AssertEvalEquals("mA", "123")
|
||||
AssertEvalEquals("mB", "234")
|
||||
AssertEvalEquals("this,na", "{ mA=123 mB=234 }")
|
||||
|
||||
AssertDbgAutocomplete("outerVar")
|
||||
AssertDbgAutocomplete("argA1")
|
||||
AssertDbgAutocomplete("this")
|
||||
AssertDbgAutocomplete("mA")
|
12
IDE/Tests/Test1/scripts/MemoryBreakpoints.txt
Normal file
12
IDE/Tests/Test1/scripts/MemoryBreakpoints.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
ShowFile("src/MemoryBreakpoints.bf")
|
||||
GotoText("//MemoryBreakpointTester_Test")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepOver()
|
||||
CreateMemoryBreakpoint("mbt")
|
||||
|
||||
Continue()
|
||||
AssertEvalEquals("a", "0")
|
||||
Continue()
|
||||
AssertEvalEquals("a", "2")
|
28
IDE/Tests/Test1/scripts/Methods.txt
Normal file
28
IDE/Tests/Test1/scripts/Methods.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
ShowFile("src/Methods.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
AssertAutocompleteEquals("ClassA.TEST_", "TEST_StaticMethodA\nTEST_StaticMethodB")
|
||||
AssertAutocompleteEquals("ca.TEST_", "TEST_MethodA\nTEST_MethodB")
|
||||
NavigateBackwards()
|
||||
AssertEvalEquals("ca.TEST_MethodA()", "200")
|
||||
AssertEvalContains("ca.TEST_MethodB()", "Unable to find address for method")
|
||||
AssertEvalEquals("ClassA.TEST_StaticMethodA()", "100")
|
||||
AssertEvalContains("ClassA.TEST_StaticMethodB()", "Unable to find address for method")
|
||||
AssertAutocompleteEquals("ClassA.TEST_", "TEST_StaticMethodA\nTEST_StaticMethodB")
|
||||
AssertAutocompleteEquals("ca.TEST_", "TEST_MethodA\nTEST_MethodB")
|
||||
NavigateBackwards()
|
||||
|
||||
ToggleCommentAt("ClassA_MethodC")
|
||||
ToggleCommentAt("ClassA_StaticMethodC")
|
||||
ToggleCommentAt("DoTest_Body")
|
||||
Compile()
|
||||
AssertEvalEquals("ca.TEST_MethodA()", "200")
|
||||
AssertEvalEquals("ca.TEST_MethodB()", "201")
|
||||
AssertEvalEquals("ca.TEST_MethodC()", "202")
|
||||
AssertEvalEquals("ClassA.TEST_StaticMethodA()", "100")
|
||||
AssertEvalEquals("ClassA.TEST_StaticMethodB()", "101")
|
||||
AssertEvalEquals("ClassA.TEST_StaticMethodC()", "102")
|
||||
AssertAutocompleteEquals("ClassA.TEST_", "TEST_StaticMethodA\nTEST_StaticMethodB\nTEST_StaticMethodC")
|
||||
AssertAutocompleteEquals("ca.TEST_", "TEST_MethodA\nTEST_MethodB\nTEST_MethodC")
|
28
IDE/Tests/Test1/scripts/Mixins.txt
Normal file
28
IDE/Tests/Test1/scripts/Mixins.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
ShowFile("src/Mixins.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertLineContains("a = 123")
|
||||
StepOver()
|
||||
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertLineContains("b + 1000")
|
||||
StepInto()
|
||||
|
||||
AssertLineContains("a + 10000")
|
||||
StepInto()
|
||||
AssertLineContains("b = a + 10")
|
||||
StepOut()
|
||||
|
||||
# This isn't strictly required
|
||||
AssertLineContains("a + 10000")
|
||||
StepOver()
|
||||
|
||||
AssertLineContains("a + 20000")
|
||||
StepOver()
|
||||
AssertLineContains("a + 30000")
|
93
IDE/Tests/Test1/scripts/Multithread.txt
Normal file
93
IDE/Tests/Test1/scripts/Multithread.txt
Normal file
|
@ -0,0 +1,93 @@
|
|||
# This tests multithreaded stepping
|
||||
# - Steps should stay in the same thread
|
||||
# - Run To Cursor should stay on the same thread
|
||||
# - Step Out should stay on the same thread
|
||||
|
||||
ShowFile("src/Multithread.bf")
|
||||
GotoText("//MultithreadTester_Test")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
AssertEvalEquals("doTest = true", "true")
|
||||
|
||||
GotoText("//ThreadFunc")
|
||||
ToggleBreakpoint()
|
||||
Continue()
|
||||
AssertEvalEquals("sLocalVal", "1")
|
||||
Continue()
|
||||
AssertEvalEquals("sLocalVal", "1")
|
||||
Continue()
|
||||
AssertEvalEquals("sLocalVal", "1")
|
||||
|
||||
# We now have all 3 threads running and we're the third one
|
||||
# We now do a series of execution tests, concentrating on the "val++" line
|
||||
# We test that "run to cursor" does a full iteration back to that
|
||||
# same line, both from having stepped onto it using "StepOver" and
|
||||
# having previously arrived there from another "RunToCursor"
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
StepOver()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
StepOver()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
StepOver()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
StepOver()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
StepOver()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
StepOver()
|
||||
AssertEvalEquals("i", "1")
|
||||
|
||||
RunToCursor()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "2")
|
||||
RunToCursor()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "3")
|
||||
|
||||
# Pass 2
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "4")
|
||||
|
||||
RunToCursor()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "5")
|
||||
RunToCursor()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "6")
|
||||
|
||||
# Pass 3
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "7")
|
||||
|
||||
RunToCursor()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "8")
|
||||
RunToCursor()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "9")
|
||||
|
||||
# Set up the StepOut test
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertEvalEquals("val", "2")
|
||||
StepOut()
|
||||
AssertEvalEquals("depth", "0")
|
||||
AssertEvalEquals("val", "5")
|
||||
|
||||
StepOut()
|
||||
AssertEvalEquals("threadNum", "2")
|
||||
AssertEvalEquals("i", "9")
|
32
IDE/Tests/Test1/scripts/Multithread02.txt
Normal file
32
IDE/Tests/Test1/scripts/Multithread02.txt
Normal file
|
@ -0,0 +1,32 @@
|
|||
# This test ensure that other threads continue to execute while we execute a method in the debugger
|
||||
# and it tests that we can execute methods on threads other than those which we had originally stopped on
|
||||
|
||||
ShowFile("src/Multithread02.bf")
|
||||
GotoText("//Thread1_0")
|
||||
ToggleBreakpoint()
|
||||
GotoText("//Thread1_1")
|
||||
ToggleBreakpoint()
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
|
||||
RunWithCompiling()
|
||||
StepOver()
|
||||
AssertEvalEquals("doTest = true", "true")
|
||||
Continue()
|
||||
AssertEvalEquals("ca.mA", "100")
|
||||
AssertEvalEquals("sVal0", "1")
|
||||
AssertEvalEquals("ca.GetValWithWait()", "100")
|
||||
AssertEvalEquals("sVal0", "2")
|
||||
SelectThread("")
|
||||
SelectCallStackWithStr(".DoTest()")
|
||||
AssertEvalEquals("ca.mA", "9")
|
||||
AssertEvalEquals("sVal1", "0")
|
||||
AssertEvalEquals("ca.GetValWithWait()", "9")
|
||||
AssertEvalEquals("sVal1", "1")
|
||||
Continue()
|
||||
|
||||
SelectThread("")
|
||||
SelectCallStackWithStr(".DoTest()")
|
||||
AssertEvalEquals("sVal1", "1")
|
||||
AssertEvalEquals("ca.GetValWithWait()", "9")
|
||||
AssertEvalEquals("sVal1", "2")
|
12
IDE/Tests/Test1/scripts/Splats.txt
Normal file
12
IDE/Tests/Test1/scripts/Splats.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
ShowFile("src/Splats.bf")
|
||||
GotoText("//SplatTester_SplatC_Call")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepInto()
|
||||
AssertEvalEquals("this", "{ mC='Z' mB=1.2 mA=123 }")
|
||||
#This fails currently
|
||||
#AssertEvalEquals("GetB()", "1.2")
|
||||
StepOver()
|
||||
AssertEvalEquals("sc.GetB()", "1.2")
|
||||
AssertEvalEquals("GetC(sc)", "123")
|
43
IDE/Tests/Test1/scripts/Stepping_Scope.txt
Normal file
43
IDE/Tests/Test1/scripts/Stepping_Scope.txt
Normal file
|
@ -0,0 +1,43 @@
|
|||
# This tests various cases of hitting breakpoints on the closing brace of a method
|
||||
# along with stepping onto a return, and stepping into scoped destructors.
|
||||
|
||||
ShowFile("src/Stepping_Scope.bf")
|
||||
GotoText("//Stepping_Scope_Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
AssertLineContains("Test1(0)")
|
||||
GotoText("//Stepping_Scope_Test1_Leave")
|
||||
ToggleBreakpoint()
|
||||
|
||||
Continue()
|
||||
AssertEvalEquals("a", "2")
|
||||
StepInto()
|
||||
AssertLineContains("b = 99")
|
||||
StepOut()
|
||||
StepOver()
|
||||
|
||||
AssertLineContains("Test1(1)")
|
||||
StepOver()
|
||||
AssertEvalEquals("a", "3")
|
||||
StepInto()
|
||||
AssertLineContains("b = 99")
|
||||
StepOut()
|
||||
StepOver()
|
||||
|
||||
AssertLineContains("Test2(0)")
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertLineContains("scope::")
|
||||
StepOver()
|
||||
StepOver()
|
||||
AssertLineContains("return")
|
||||
StepOver()
|
||||
AssertLineContains("}")
|
||||
StepInto()
|
||||
AssertLineContains("b = 99")
|
||||
StepOut()
|
||||
StepOver()
|
||||
|
||||
AssertLineContains("Test2(1)")
|
27
IDE/Tests/Test1/scripts/Unions.txt
Normal file
27
IDE/Tests/Test1/scripts/Unions.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
ShowFile("src/Unions.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
|
||||
AssertEvalEquals("a", "12")
|
||||
AssertEvalEquals("b", "23")
|
||||
AssertEvalEquals("us.mInnerB.mInnerA.mInt0", "12")
|
||||
AssertEvalEquals("us.mInnerB.mInnerA.mInt1", "23")
|
||||
|
||||
StepOut()
|
||||
StepOver()
|
||||
StepOver()
|
||||
StepInto()
|
||||
StepOver()
|
||||
StepOver()
|
||||
|
||||
AssertEvalEquals("a2", "1432778632")
|
||||
AssertEvalEquals("b2", "287454020")
|
||||
AssertEvalEquals("us.mInnerB.mInnerA.mInt0", "1432778632")
|
||||
AssertEvalEquals("us.mInnerB.mInnerA.mInt1", "287454020")
|
22
IDE/Tests/Test1/scripts/Virtuals.txt
Normal file
22
IDE/Tests/Test1/scripts/Virtuals.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
# This checks that virtual method calls work in the debugger,
|
||||
# and also ensures that the virtual indicies properly remap
|
||||
# after the interface slot count increases between compiles
|
||||
|
||||
ShowFile("src/Virtuals.bf")
|
||||
GotoText("//Test_Start")
|
||||
ToggleBreakpoint()
|
||||
|
||||
RunWithCompiling()
|
||||
AssertEvalEquals("ca.GetA(9)", "2009")
|
||||
AssertEvalEquals("cb.GetA(11)", "2011")
|
||||
AssertEvalEquals("ca.Korf", "234")
|
||||
AssertEvalEquals("cb.Korf", "234")
|
||||
StopRunning()
|
||||
|
||||
ToggleCommentAt("ClassA_IFaces")
|
||||
ToggleCommentAt("Test_IFaces")
|
||||
RunWithCompiling()
|
||||
AssertEvalEquals("ca.GetA(9)", "2009")
|
||||
AssertEvalEquals("cb.GetA(11)", "2011")
|
||||
AssertEvalEquals("ca.Korf", "234")
|
||||
AssertEvalEquals("cb.Korf", "234")
|
25
IDE/Tests/Test1/src/Assembly.bf
Normal file
25
IDE/Tests/Test1/src/Assembly.bf
Normal file
|
@ -0,0 +1,25 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Assembly
|
||||
{
|
||||
public static int IncVal(ref int val)
|
||||
{
|
||||
val++;
|
||||
return val;
|
||||
}
|
||||
|
||||
public static void Test1()
|
||||
{
|
||||
int a = 0;
|
||||
int d = IncVal(ref a) + IncVal(ref a) + IncVal(ref a);
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//AssemblyTester_Test
|
||||
Test1();
|
||||
}
|
||||
}
|
||||
}
|
26
IDE/Tests/Test1/src/Break.bf
Normal file
26
IDE/Tests/Test1/src/Break.bf
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Threading;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Break
|
||||
{
|
||||
public static void Infinite()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
//Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
int a = 0;
|
||||
a++;
|
||||
a++;
|
||||
a++;
|
||||
if (a == -1)
|
||||
Infinite();
|
||||
}
|
||||
}
|
||||
}
|
36
IDE/Tests/Test1/src/Breakpoints.bf
Normal file
36
IDE/Tests/Test1/src/Breakpoints.bf
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Breakpoints
|
||||
{
|
||||
public static void Recurse(int a)
|
||||
{
|
||||
int b = 234;
|
||||
//Recurse_C
|
||||
int c = 345;
|
||||
|
||||
if (a == 10)
|
||||
return;
|
||||
|
||||
Recurse(a + 1);
|
||||
int d = 100 + a;
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//BreakpointTester_Test
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
|
||||
while (a < 20)
|
||||
{
|
||||
//BreakpointTester_LoopA
|
||||
a++;
|
||||
}
|
||||
|
||||
//BreakpointTester_Recurse
|
||||
Recurse(0);
|
||||
}
|
||||
}
|
||||
}
|
27
IDE/Tests/Test1/src/Breakpoints02.bf
Normal file
27
IDE/Tests/Test1/src/Breakpoints02.bf
Normal file
|
@ -0,0 +1,27 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Breakpoints02
|
||||
{
|
||||
static void MethodA()
|
||||
{
|
||||
int a = 0;
|
||||
for (int i < 3)
|
||||
{
|
||||
a++;
|
||||
//MethodA_1
|
||||
a++;
|
||||
//MethodA_2
|
||||
a++;
|
||||
a++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
MethodA();
|
||||
}
|
||||
}
|
||||
}
|
34
IDE/Tests/Test1/src/Enums.bf
Normal file
34
IDE/Tests/Test1/src/Enums.bf
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
enum EnumA
|
||||
{
|
||||
case A(int a);
|
||||
case B(float b);
|
||||
}
|
||||
|
||||
enum EnumB
|
||||
{
|
||||
case A;
|
||||
case B;
|
||||
case C;
|
||||
}
|
||||
|
||||
class EnumTester
|
||||
{
|
||||
public static void Test()
|
||||
{
|
||||
EnumA ea = .B(1.2f);
|
||||
|
||||
let z = (aa:123, bb:345);
|
||||
var q = (a:234, 567, c:999);
|
||||
|
||||
var qRef = ref q;
|
||||
|
||||
EnumB eb = .B;
|
||||
|
||||
//EnumTester_Test
|
||||
}
|
||||
}
|
||||
}
|
248
IDE/Tests/Test1/src/HotSwap.bf
Normal file
248
IDE/Tests/Test1/src/HotSwap.bf
Normal file
|
@ -0,0 +1,248 @@
|
|||
using System.Diagnostics;
|
||||
using System;
|
||||
|
||||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
interface IHot
|
||||
{
|
||||
int IHotA();
|
||||
/*IHot_IHotB
|
||||
int IHotB();
|
||||
*/
|
||||
}
|
||||
|
||||
class HotA : IHot
|
||||
{
|
||||
public virtual int MethodA()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
//*HotA_MethodB
|
||||
public virtual int MethodB()
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
/*@*/
|
||||
|
||||
/*HotA_MethodC
|
||||
public virtual int MethodC()
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
*/
|
||||
|
||||
// Note- this is purposely beneath MethodC
|
||||
/*HotA_MethodB_2
|
||||
public virtual int MethodB()
|
||||
{
|
||||
return 111;
|
||||
}
|
||||
*/
|
||||
|
||||
/*HotA_MethodD
|
||||
public virtual int MethodD()
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
*/
|
||||
|
||||
public virtual int MethodE()
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
|
||||
public int IHotA()
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
public int IHotB()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
}
|
||||
|
||||
class HotB : HotA
|
||||
{
|
||||
public override int MethodA()
|
||||
{
|
||||
//HotB_MethodA_Return
|
||||
return 20;
|
||||
}
|
||||
|
||||
/*HotB_MethodB_Start
|
||||
public override int MethodB()
|
||||
{
|
||||
return 21;
|
||||
}
|
||||
*/
|
||||
|
||||
/*HotB_MethodC_Start
|
||||
public override int MethodC()
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
class HotTester
|
||||
{
|
||||
|
||||
public void Test2(HotA hot)
|
||||
{
|
||||
/*HotTester_Test2
|
||||
int val = hot.MethodC();
|
||||
*/
|
||||
}
|
||||
|
||||
public void Test3(HotA hot)
|
||||
{
|
||||
/*HotTester_Test3
|
||||
int val = hot.MethodE();
|
||||
*/
|
||||
}
|
||||
|
||||
public void Test1()
|
||||
{
|
||||
//*HotTester_Test1
|
||||
|
||||
HotA hot = scope HotB();
|
||||
|
||||
//HotStart
|
||||
int val = hot.MethodA();
|
||||
val = hot.MethodB();
|
||||
val = hot.MethodB();
|
||||
|
||||
Test2(hot);
|
||||
|
||||
//HotTester_Test1_EndTest
|
||||
val = 99;
|
||||
|
||||
Test3(hot);
|
||||
|
||||
/*@*/
|
||||
}
|
||||
|
||||
public void TestVirtualRemap2(HotA hot)
|
||||
{
|
||||
/*HotTester_TestVirtualRemap2_MethodCCall
|
||||
int val = hot.MethodC();
|
||||
*/
|
||||
}
|
||||
|
||||
public void TestVirtualRemap()
|
||||
{
|
||||
//HotStart_VirtualRemap
|
||||
HotA hot = scope HotB();
|
||||
|
||||
//*HotTester_TestVirtualRemap_MethodBCall
|
||||
int val = hot.MethodB();
|
||||
/*@*/
|
||||
|
||||
TestVirtualRemap2(hot);
|
||||
|
||||
//*HotTester_TestVirtualRemap_MethodBCall_2
|
||||
val = hot.MethodB();
|
||||
/*@*/
|
||||
}
|
||||
|
||||
static public int TestFuncs_Func()
|
||||
{
|
||||
//HotTester_TestFuncs_Func_Return
|
||||
return 123;
|
||||
}
|
||||
|
||||
/*HotTester_TestFuncs_Func2
|
||||
static public int TestFuncs_Func2()
|
||||
{
|
||||
//HotTester_TestFuncs_Func2_Return
|
||||
return 444;
|
||||
}
|
||||
*/
|
||||
|
||||
public void TestFuncs_Compare(HotA hot, delegate int() dlgA0, delegate int() dlgT0, function int() funcT0)
|
||||
{
|
||||
delegate int() dlgA1 = scope => hot.MethodA;
|
||||
delegate int() dlgT1 = scope => TestFuncs_Func;
|
||||
function int() funcT1 = => TestFuncs_Func;
|
||||
|
||||
Debug.Assert(Delegate.Equals(dlgA0, dlgA1));
|
||||
Debug.Assert(Delegate.Equals(dlgT0, dlgT1));
|
||||
Debug.Assert(funcT0 == funcT1);
|
||||
|
||||
//TestFuncs_Compare_Calls
|
||||
int val = dlgA0();
|
||||
val = dlgT0();
|
||||
val = funcT0();
|
||||
}
|
||||
|
||||
public void TestFuncs()
|
||||
{
|
||||
//HotStart_Funcs
|
||||
HotA hot = scope HotB();
|
||||
//Debug.WriteLine("Result: {0}", hot);
|
||||
|
||||
delegate int() dlgA0 = scope => hot.MethodA;
|
||||
delegate int() dlgT0 = scope => TestFuncs_Func;
|
||||
function int() funcT0 = => TestFuncs_Func;
|
||||
TestFuncs_Compare(hot, dlgA0, dlgT0, funcT0);
|
||||
}
|
||||
|
||||
public void TestFuncs2_Compare(function int() funcT0)
|
||||
{
|
||||
/*TestFuncs2_Compare_Body
|
||||
function int() funcT1 = => TestFuncs_Func2;
|
||||
Debug.Assert(funcT1 == funcT0);
|
||||
*/
|
||||
int val = funcT0();
|
||||
}
|
||||
|
||||
public void TestFuncs2()
|
||||
{
|
||||
/*TestFuncs2_Body
|
||||
function int() funcT0 = => TestFuncs_Func2;
|
||||
TestFuncs2_Compare(funcT0);
|
||||
*/
|
||||
}
|
||||
|
||||
public void TestIHotA(HotA hot)
|
||||
{
|
||||
/*HotTester_TestIHotA
|
||||
IHot ihot = hot;
|
||||
int val = ihot.IHotA();
|
||||
*/
|
||||
}
|
||||
|
||||
public void TestIHotB(HotA hot)
|
||||
{
|
||||
/*HotTester_TestIHotB
|
||||
IHot ihot = hot;
|
||||
int val = ihot.IHotB();
|
||||
*/
|
||||
}
|
||||
|
||||
public void TestInterfaces()
|
||||
{
|
||||
//HotStart_Interfaces
|
||||
HotA hot = scope HotB();
|
||||
TestIHotA(hot);
|
||||
TestIHotB(hot);
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
HotTester ht = scope .();
|
||||
ht.Test1();
|
||||
ht.Test1();
|
||||
|
||||
ht.TestVirtualRemap();
|
||||
ht.TestFuncs();
|
||||
ht.TestFuncs2();
|
||||
ht.TestInterfaces();
|
||||
}
|
||||
}
|
||||
}
|
143
IDE/Tests/Test1/src/HotSwap_BaseChange.bf
Normal file
143
IDE/Tests/Test1/src/HotSwap_BaseChange.bf
Normal file
|
@ -0,0 +1,143 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class HotSwap_BaseChange
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
public virtual int MethodA0()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
public virtual int MethodA1()
|
||||
{
|
||||
return 101;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassB
|
||||
{
|
||||
public virtual int MethodB0()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
|
||||
/*ClassB_MethodB1
|
||||
public virtual int MethodB1()
|
||||
{
|
||||
return 201;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*ClassC_0
|
||||
class ClassC : ClassA
|
||||
{
|
||||
public virtual int MethodC0()
|
||||
{
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*ClassC_1
|
||||
class ClassC : ClassB
|
||||
{
|
||||
public virtual int MethodC0()
|
||||
{
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*ClassC_2
|
||||
class ClassC : ClassB
|
||||
{
|
||||
public virtual int MethodC0()
|
||||
{
|
||||
return 1300;
|
||||
}
|
||||
|
||||
public virtual int MethodC1()
|
||||
{
|
||||
return 1301;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*ClassC_3
|
||||
class ClassC : ClassA
|
||||
{
|
||||
// FAILS
|
||||
public this() : base(123)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual int MethodC0()
|
||||
{
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static void DoTest0()
|
||||
{
|
||||
/*DoTest0_Body
|
||||
ClassC cc = scope .();
|
||||
int a0 = cc.MethodA0();
|
||||
int a1 = cc.MethodA1();
|
||||
int c0 = cc.MethodC0();
|
||||
*/
|
||||
}
|
||||
|
||||
static void DoTest1()
|
||||
{
|
||||
/*DoTest1_Body
|
||||
ClassC cc = scope .();
|
||||
int b0 = cc.MethodB0();
|
||||
int c0 = cc.MethodC0();
|
||||
b0 = cc.MethodB0();
|
||||
c0 = cc.MethodC0();
|
||||
DoTest2(cc);
|
||||
*/
|
||||
}
|
||||
|
||||
/*DoTest2_Decl
|
||||
static void DoTest2(ClassC cc)
|
||||
{
|
||||
/*DoTest2_Body
|
||||
int b0 = cc.MethodB0();
|
||||
int b1 = cc.MethodB1();
|
||||
int c0 = cc.MethodC0();
|
||||
int c1 = cc.MethodC1();
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
static void DoTest3()
|
||||
{
|
||||
/*DoTest3_Body
|
||||
ClassC cc = scope .();
|
||||
*/
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
// Reify these methods and types
|
||||
ClassA ca = scope .();
|
||||
ca.MethodA0();
|
||||
ca.MethodA1();
|
||||
ClassB cb = scope .();
|
||||
cb.MethodB0();
|
||||
|
||||
int a = 0;
|
||||
//Test_Start
|
||||
DoTest0();
|
||||
DoTest1();
|
||||
DoTest3();
|
||||
}
|
||||
}
|
||||
}
|
137
IDE/Tests/Test1/src/HotSwap_Data.bf
Normal file
137
IDE/Tests/Test1/src/HotSwap_Data.bf
Normal file
|
@ -0,0 +1,137 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class HotSwap_Data
|
||||
{
|
||||
struct StructA
|
||||
{
|
||||
public int mA = 100;
|
||||
/*StructA_mA2
|
||||
public int mA2 = 101;
|
||||
*/
|
||||
/*StructA_mA3
|
||||
public int mA3 = 102;
|
||||
*/
|
||||
}
|
||||
|
||||
struct StructB
|
||||
{
|
||||
public int mB;
|
||||
}
|
||||
|
||||
struct StructC : StructA
|
||||
{
|
||||
public StructB mSB;
|
||||
public int mC;
|
||||
}
|
||||
|
||||
interface IFaceA
|
||||
{
|
||||
void IMethodA();
|
||||
}
|
||||
|
||||
interface IFaceB
|
||||
{
|
||||
void IMethodB();
|
||||
}
|
||||
|
||||
class ClassA : IFaceA
|
||||
{
|
||||
public void IMethodA()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class ClassB : IFaceB
|
||||
{
|
||||
public void IMethodB()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class ClassC :
|
||||
//*ClassC_IFaceA
|
||||
IFaceA
|
||||
/*@*/
|
||||
/*ClassC_IFaceB_WithoutComma
|
||||
IFaceB
|
||||
*/
|
||||
/*ClassC_IFaceB_WithComma
|
||||
, IFaceB
|
||||
*/
|
||||
{
|
||||
public void IMethodA()
|
||||
{
|
||||
}
|
||||
|
||||
public void IMethodB()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
static void Test01()
|
||||
{
|
||||
StructC sc = .();
|
||||
/*Test01_mA2
|
||||
int val = sc.mA2;
|
||||
*/
|
||||
}
|
||||
|
||||
//*Func
|
||||
[AlwaysInclude]
|
||||
static void Func()
|
||||
{
|
||||
StructA sa = .();
|
||||
}
|
||||
/*@*/
|
||||
|
||||
static void Test02()
|
||||
{
|
||||
}
|
||||
|
||||
static void Test03()
|
||||
{
|
||||
/*Test03_delegate
|
||||
delegate void() funcPtr = new => Func;
|
||||
Console.WriteLine("Delegate: {0}", funcPtr);
|
||||
*/
|
||||
}
|
||||
|
||||
static void Test04()
|
||||
{
|
||||
ClassA ca = scope .();
|
||||
IFaceA ia = ca;
|
||||
ia.IMethodA();
|
||||
ClassB cb = scope .();
|
||||
IFaceB ib = cb;
|
||||
ib.IMethodB();
|
||||
ClassC cc = scope .();
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
/*Test_funcPtr
|
||||
function void() funcPtr = => Func;
|
||||
*/
|
||||
|
||||
int a = 0;
|
||||
//Test_Test01
|
||||
Test01();
|
||||
Test01();
|
||||
|
||||
//Test_Test02
|
||||
Test02();
|
||||
|
||||
//Test_Test03
|
||||
Test03();
|
||||
Test03();
|
||||
|
||||
//Test_Test04
|
||||
Test04();
|
||||
}
|
||||
}
|
||||
}
|
36
IDE/Tests/Test1/src/HotSwap_GetUnused.bf
Normal file
36
IDE/Tests/Test1/src/HotSwap_GetUnused.bf
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class HotSwap_GetUnusued
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
public void MethodA()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int MethodB()
|
||||
{
|
||||
return 123;
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoTest()
|
||||
{
|
||||
ClassA ca = scope .();
|
||||
ca.MethodA();
|
||||
/*DoTest_MethodB
|
||||
int val = ca.MethodB();
|
||||
*/
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
int a = 123;
|
||||
//Test
|
||||
DoTest();
|
||||
}
|
||||
}
|
||||
}
|
46
IDE/Tests/Test1/src/HotSwap_Interfaces2.bf
Normal file
46
IDE/Tests/Test1/src/HotSwap_Interfaces2.bf
Normal file
|
@ -0,0 +1,46 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class HotSwap_Interfaces2
|
||||
{
|
||||
interface IFaceA
|
||||
{
|
||||
int Method0();
|
||||
/*IFaceA_Method1
|
||||
int Method1();
|
||||
*/
|
||||
}
|
||||
|
||||
class ClassA : IFaceA
|
||||
{
|
||||
public int Method0()
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
|
||||
/*ClassA_Method1
|
||||
public int Method1()
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static void Test1(IFaceA ia)
|
||||
{
|
||||
/*Test1_Method1
|
||||
int v1 = ia.Method1();
|
||||
*/
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
ClassA ca = scope .();
|
||||
IFaceA ia = ca;
|
||||
//Test_Start
|
||||
int v0 = ia.Method0();
|
||||
Test1(ia);
|
||||
}
|
||||
}
|
||||
}
|
37
IDE/Tests/Test1/src/HotSwap_Reflection.bf
Normal file
37
IDE/Tests/Test1/src/HotSwap_Reflection.bf
Normal file
|
@ -0,0 +1,37 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class HotSwap_Reflection
|
||||
{
|
||||
[Reflect]
|
||||
class ClassA
|
||||
{
|
||||
int mA;//ClassA_mA
|
||||
|
||||
public static Type GetMyType()
|
||||
{
|
||||
return typeof(ClassA);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
let t0 = ClassA.GetMyType();
|
||||
for (let field in t0.GetFields())
|
||||
{
|
||||
}
|
||||
let t1 = ClassA.GetMyType();
|
||||
for (let field in t1.GetFields())
|
||||
{
|
||||
}
|
||||
let t2 = ClassA.GetMyType();
|
||||
for (let field in t2.GetFields())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
95
IDE/Tests/Test1/src/HotSwap_TLS.bf
Normal file
95
IDE/Tests/Test1/src/HotSwap_TLS.bf
Normal file
|
@ -0,0 +1,95 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class HotSwap_TLS
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
[ThreadStatic]
|
||||
public static int sTLS0;
|
||||
|
||||
/*ClassA_TLS1
|
||||
[ThreadStatic]
|
||||
public static int sTLS1;
|
||||
*/
|
||||
}
|
||||
|
||||
static Monitor sMonitor = new .() ~ delete _;
|
||||
static WaitEvent sEvent = new .() ~ delete _;
|
||||
static WaitEvent sDoneEvent = new .() ~ delete _;
|
||||
static int sThreadResult;
|
||||
|
||||
public static int Inc0()
|
||||
{
|
||||
return ++ClassA.sTLS0;
|
||||
}
|
||||
|
||||
public static int Inc1()
|
||||
{
|
||||
/*Inc1_TLS1
|
||||
return ++ClassA.sTLS1;
|
||||
*/
|
||||
#unwarn
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void Thread0()
|
||||
{
|
||||
sEvent.WaitFor();
|
||||
sThreadResult = Inc0();
|
||||
sDoneEvent.Set();
|
||||
|
||||
sEvent.WaitFor();
|
||||
sThreadResult = Inc0();
|
||||
sDoneEvent.Set();
|
||||
|
||||
sEvent.WaitFor();
|
||||
sThreadResult = Inc1();
|
||||
sDoneEvent.Set();
|
||||
|
||||
sEvent.WaitFor();
|
||||
sThreadResult = Inc1();
|
||||
sDoneEvent.Set();
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
let thread = scope Thread(new => Thread0);
|
||||
thread.Start(false);
|
||||
|
||||
int val = Inc0();
|
||||
val = Inc0();
|
||||
val = Inc0();
|
||||
Debug.Assert(val == 3);
|
||||
|
||||
sEvent.Set();
|
||||
sDoneEvent.WaitFor();
|
||||
Debug.Assert(sThreadResult == 1);
|
||||
|
||||
sEvent.Set();
|
||||
sDoneEvent.WaitFor();
|
||||
Debug.Assert(sThreadResult == 2);
|
||||
|
||||
val = Inc1();
|
||||
val = Inc1();
|
||||
val = Inc1();
|
||||
NOP!();//Debug.Assert(val == 3);
|
||||
|
||||
sEvent.Set();
|
||||
sDoneEvent.WaitFor();
|
||||
NOP!();//Debug.Assert(sThreadResult == 1);
|
||||
|
||||
sEvent.Set();
|
||||
sDoneEvent.WaitFor();
|
||||
NOP!();//Debug.Assert(sThreadResult == 2);
|
||||
|
||||
thread.Join();
|
||||
}
|
||||
}
|
||||
}
|
60
IDE/Tests/Test1/src/Inline.bf
Normal file
60
IDE/Tests/Test1/src/Inline.bf
Normal file
|
@ -0,0 +1,60 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class InlineTester
|
||||
{
|
||||
[Inline]
|
||||
public static int TimesTwo(int a)
|
||||
{
|
||||
return a * 2;
|
||||
}
|
||||
|
||||
[Inline]
|
||||
public static int Add(int a, int b)
|
||||
{
|
||||
int retVal = TimesTwo(a);
|
||||
retVal += TimesTwo(b);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static int PlusOne(int a)
|
||||
{
|
||||
return a + 1;
|
||||
}
|
||||
|
||||
public static mixin MixB(var argC)
|
||||
{
|
||||
argC = PlusOne(argC);
|
||||
argC
|
||||
}
|
||||
|
||||
public static mixin MixA(var argA, var argB)
|
||||
{
|
||||
int z = MixB!(argA);
|
||||
argA + argB
|
||||
}
|
||||
|
||||
public static void TestInlines()
|
||||
{
|
||||
int a = 123;
|
||||
int b = 234;
|
||||
int d = Add(a, b);
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
int a = 10;
|
||||
int b = 2;
|
||||
|
||||
//InlineTester
|
||||
int c = MixA!(a, b);
|
||||
|
||||
TestInlines();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
31
IDE/Tests/Test1/src/Lambdas.bf
Normal file
31
IDE/Tests/Test1/src/Lambdas.bf
Normal file
|
@ -0,0 +1,31 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class LambdaTester
|
||||
{
|
||||
public int mA = 123;
|
||||
public int mB = 234;
|
||||
|
||||
public void Test1()
|
||||
{
|
||||
int outerVar = 88;
|
||||
|
||||
delegate int(int argA0) dlg = scope (argA1) =>
|
||||
{
|
||||
int a = mA;
|
||||
int b = outerVar;
|
||||
return 222;
|
||||
};
|
||||
|
||||
//LambdaTest_Test1
|
||||
dlg(99);
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
LambdaTester lt = scope .();
|
||||
lt.Test1();
|
||||
}
|
||||
}
|
||||
}
|
23
IDE/Tests/Test1/src/MemoryBreakpoints.bf
Normal file
23
IDE/Tests/Test1/src/MemoryBreakpoints.bf
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class MemoryBreakpointTester
|
||||
{
|
||||
int mA;
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//MemoryBreakpointTester_Test
|
||||
MemoryBreakpointTester mbt = scope .();
|
||||
|
||||
int a = 0;
|
||||
mbt.mA++;
|
||||
a++;
|
||||
a++;
|
||||
mbt.mA++;
|
||||
a++;
|
||||
a++;
|
||||
}
|
||||
}
|
||||
}
|
62
IDE/Tests/Test1/src/Methods.bf
Normal file
62
IDE/Tests/Test1/src/Methods.bf
Normal file
|
@ -0,0 +1,62 @@
|
|||
namespace IDETest
|
||||
{
|
||||
class Methods
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
public int TEST_MethodA()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
|
||||
public int TEST_MethodB()
|
||||
{
|
||||
return 201;
|
||||
}
|
||||
|
||||
/*ClassA_MethodC
|
||||
public int TEST_MethodC()
|
||||
{
|
||||
return 202;
|
||||
}
|
||||
*/
|
||||
|
||||
public static int TEST_StaticMethodA()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
public static int TEST_StaticMethodB()
|
||||
{
|
||||
return 101;
|
||||
}
|
||||
|
||||
/*ClassA_StaticMethodC
|
||||
public static int TEST_StaticMethodC()
|
||||
{
|
||||
return 102;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public static void DoTest()
|
||||
{
|
||||
/*DoTest_Body
|
||||
ClassA ca = scope .();
|
||||
ca.TEST_MethodB();
|
||||
ca.TEST_MethodC();
|
||||
ClassA.TEST_StaticMethodB();
|
||||
ClassA.TEST_StaticMethodC();
|
||||
*/
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
ClassA ca = scope .();
|
||||
ca.TEST_MethodA();
|
||||
ClassA.TEST_StaticMethodA();
|
||||
DoTest();
|
||||
}
|
||||
}
|
||||
}
|
45
IDE/Tests/Test1/src/Mixins.bf
Normal file
45
IDE/Tests/Test1/src/Mixins.bf
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
|
||||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Mixins
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
public String mStr;
|
||||
}
|
||||
|
||||
public static mixin MixA(int a)
|
||||
{
|
||||
int b = a + 10;
|
||||
b + 100
|
||||
}
|
||||
|
||||
public static mixin MixB(int a)
|
||||
{
|
||||
int c = MixA!(a + 10000);
|
||||
int d = MixA!(a + 20000);
|
||||
int e = MixA!(a + 30000);
|
||||
}
|
||||
|
||||
public static mixin MixC(int a)
|
||||
{
|
||||
int b = 100;
|
||||
MixB!(b);
|
||||
MixB!(b + 1000);
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
ClassA ca = scope .();
|
||||
ca.mStr = new String("Boof");
|
||||
|
||||
DeleteAndNullify!(ca.mStr);
|
||||
int a = 123;
|
||||
MixC!(1);
|
||||
}
|
||||
}
|
||||
}
|
79
IDE/Tests/Test1/src/Multithread.bf
Normal file
79
IDE/Tests/Test1/src/Multithread.bf
Normal file
|
@ -0,0 +1,79 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System.Threading;
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Multithread
|
||||
{
|
||||
public bool mDone;
|
||||
public WaitEvent mStartedProc = new WaitEvent() ~ delete _;
|
||||
|
||||
//TODO: Doesn't work with anything other than 0
|
||||
[ThreadStatic]
|
||||
public static int sLocalVal = 0;
|
||||
|
||||
public void DoRecurse(int depth, ref int val)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
++val;
|
||||
if (val < 5)
|
||||
{
|
||||
DoRecurse(depth + 1, ref val);
|
||||
}
|
||||
}
|
||||
|
||||
public void ThreadFunc(Object obj)
|
||||
{
|
||||
int threadNum = (int)obj;
|
||||
sLocalVal++;
|
||||
|
||||
String threadName = scope .();
|
||||
Thread.CurrentThread.GetName(threadName);
|
||||
|
||||
mStartedProc.Set();
|
||||
|
||||
//ThreadFunc
|
||||
int val = 0;
|
||||
for (int i < 200)
|
||||
{
|
||||
val = 0; DoRecurse(0, ref val);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//MultithreadTester_Test
|
||||
bool doTest = false;
|
||||
if (!doTest)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Multithread mt = scope Multithread();
|
||||
|
||||
Thread threadA = scope .(new => mt.ThreadFunc);
|
||||
threadA.SetName("ThreadA");
|
||||
threadA.Start(0, false);
|
||||
mt.mStartedProc.WaitFor();
|
||||
|
||||
Thread threadB = scope .(new => mt.ThreadFunc);
|
||||
threadB.SetName("ThreadB");
|
||||
threadB.Start(1, false);
|
||||
mt.mStartedProc.WaitFor();
|
||||
|
||||
Thread threadC = scope .(new => mt.ThreadFunc);
|
||||
threadC.SetName("ThreadC");
|
||||
threadC.Start(2, false);
|
||||
mt.mStartedProc.WaitFor();
|
||||
|
||||
threadA.Join();
|
||||
threadB.Join();
|
||||
threadC.Join();
|
||||
|
||||
int a = 99;
|
||||
}
|
||||
}
|
||||
}
|
71
IDE/Tests/Test1/src/Multithread02.bf
Normal file
71
IDE/Tests/Test1/src/Multithread02.bf
Normal file
|
@ -0,0 +1,71 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System.Threading;
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Multithread02
|
||||
{
|
||||
public static WaitEvent sEvent0 = new WaitEvent() ~ delete _;
|
||||
public static WaitEvent sEvent1 = new WaitEvent() ~ delete _;
|
||||
public static int sVal0;
|
||||
public static int sVal1;
|
||||
|
||||
class ClassA
|
||||
{
|
||||
public int mA;
|
||||
|
||||
[AlwaysInclude]
|
||||
public int GetValWithWait()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
return mA;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Thread1()
|
||||
{
|
||||
Thread.CurrentThread.SetName("Test_Thread1");
|
||||
|
||||
ClassA ca = scope .();
|
||||
ca.mA = 100;
|
||||
Thread.Sleep(100);
|
||||
|
||||
//Thread1_0
|
||||
sEvent0.Set();
|
||||
Interlocked.Increment(ref sVal1);
|
||||
sEvent1.WaitFor();
|
||||
|
||||
//Thread1_1
|
||||
Interlocked.Increment(ref sVal1);
|
||||
}
|
||||
|
||||
public static void DoTest()
|
||||
{
|
||||
ClassA ca = scope .();
|
||||
ca.mA = 9;
|
||||
|
||||
Thread thread1 = scope .(new => Thread1);
|
||||
thread1.Start(false);
|
||||
Interlocked.Increment(ref sVal0);
|
||||
Thread.Sleep(500);
|
||||
Interlocked.Increment(ref sVal0);
|
||||
|
||||
sEvent0.WaitFor();
|
||||
sEvent1.Set();
|
||||
|
||||
thread1.Join();
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
bool doTest = false;
|
||||
if (doTest)
|
||||
{
|
||||
DoTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
35
IDE/Tests/Test1/src/Program.bf
Normal file
35
IDE/Tests/Test1/src/Program.bf
Normal file
|
@ -0,0 +1,35 @@
|
|||
namespace IDETest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
Assembly.Test();
|
||||
Break.Test();
|
||||
Breakpoints.Test();
|
||||
Breakpoints02.Test();
|
||||
EnumTester.Test();
|
||||
HotTester.Test();
|
||||
HotSwap_BaseChange.Test();
|
||||
HotSwap_Data.Test();
|
||||
HotSwap_GetUnusued.Test();
|
||||
HotSwap_Interfaces2.Test();
|
||||
HotSwap_Reflection.Test();
|
||||
HotSwap_TLS.Test();
|
||||
InlineTester.Test();
|
||||
LambdaTester.Test();
|
||||
Methods.Test();
|
||||
Mixins.Test();
|
||||
Multithread.Test();
|
||||
Multithread02.Test();
|
||||
MemoryBreakpointTester.Test();
|
||||
SplatTester.Test();
|
||||
Stepping_Scope.Test();
|
||||
Unions.Test();
|
||||
Virtuals.Test();
|
||||
|
||||
Bug001.Test();
|
||||
Bug002.Test();
|
||||
}
|
||||
}
|
||||
}
|
48
IDE/Tests/Test1/src/Splats.bf
Normal file
48
IDE/Tests/Test1/src/Splats.bf
Normal file
|
@ -0,0 +1,48 @@
|
|||
namespace IDETest
|
||||
{
|
||||
struct SplatA
|
||||
{
|
||||
public int mA;
|
||||
}
|
||||
|
||||
struct SplatB : SplatA
|
||||
{
|
||||
public float mB;
|
||||
}
|
||||
|
||||
struct SplatC : SplatB
|
||||
{
|
||||
public char8 mC;
|
||||
|
||||
public void DoTest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public float GetB()
|
||||
{
|
||||
return mB;
|
||||
}
|
||||
}
|
||||
|
||||
class SplatTester
|
||||
{
|
||||
public static int GetC(SplatC sc)
|
||||
{
|
||||
return sc.mA;
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
SplatC sc = .();
|
||||
sc.mA = 123;
|
||||
sc.mB = 1.2f;
|
||||
sc.mC = 'Z';
|
||||
|
||||
//SplatTester_SplatC_Call
|
||||
sc.DoTest();
|
||||
sc.GetB();
|
||||
GetC(sc);
|
||||
}
|
||||
}
|
||||
}
|
55
IDE/Tests/Test1/src/Stepping_Scope.bf
Normal file
55
IDE/Tests/Test1/src/Stepping_Scope.bf
Normal file
|
@ -0,0 +1,55 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Stepping_Scope
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
public ~this()
|
||||
{
|
||||
int b = 99;
|
||||
}
|
||||
}
|
||||
|
||||
static void Test1(int inVal)
|
||||
{
|
||||
int a = 1;
|
||||
var ca = scope ClassA();
|
||||
|
||||
if (inVal == 0)
|
||||
{
|
||||
a = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
a = 3;
|
||||
//Stepping_Scope_Test1_Leave
|
||||
}
|
||||
|
||||
static void Test2(int inVal)
|
||||
{
|
||||
int a = 1;
|
||||
|
||||
if (inVal == 0)
|
||||
{
|
||||
var ca = scope:: ClassA();
|
||||
a = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
a = 3;
|
||||
//Stepping_Scope_Test1_Leave
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Stepping_Scope_Test_Start
|
||||
Test1(0);
|
||||
Test1(1);
|
||||
|
||||
Test2(0);
|
||||
Test2(1);
|
||||
}
|
||||
}
|
||||
}
|
58
IDE/Tests/Test1/src/Unions.bf
Normal file
58
IDE/Tests/Test1/src/Unions.bf
Normal file
|
@ -0,0 +1,58 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Unions
|
||||
{
|
||||
struct InnerA
|
||||
{
|
||||
public int32 mInt0;
|
||||
public int32 mInt1;
|
||||
}
|
||||
|
||||
struct InnerB
|
||||
{
|
||||
public InnerA mInnerA;
|
||||
}
|
||||
|
||||
[Union]
|
||||
struct UStruct
|
||||
{
|
||||
public InnerB mInnerB;
|
||||
}
|
||||
|
||||
[Union]
|
||||
struct UStruct2
|
||||
{
|
||||
public InnerB mInnerB;
|
||||
public int64 mFullInt;
|
||||
}
|
||||
|
||||
public static void UseUnion(UStruct us)
|
||||
{
|
||||
int a = us.mInnerB.mInnerA.mInt0;
|
||||
int b = us.mInnerB.mInnerA.mInt1;
|
||||
}
|
||||
|
||||
public static void UseUnion2(UStruct2 us)
|
||||
{
|
||||
int a2 = us.mInnerB.mInnerA.mInt0;
|
||||
int b2 = us.mInnerB.mInnerA.mInt1;
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
UStruct us;
|
||||
us.mInnerB.mInnerA.mInt0 = 12;
|
||||
us.mInnerB.mInnerA.mInt1 = 23;
|
||||
UseUnion(us);
|
||||
|
||||
UStruct2 us2;
|
||||
us2..mFullInt = 0x11223344'55667788;
|
||||
UseUnion2(us2);
|
||||
}
|
||||
}
|
||||
}
|
99
IDE/Tests/Test1/src/Virtuals.bf
Normal file
99
IDE/Tests/Test1/src/Virtuals.bf
Normal file
|
@ -0,0 +1,99 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Virtuals
|
||||
{
|
||||
|
||||
class ClassA
|
||||
{
|
||||
public virtual int GetA(int a)
|
||||
{
|
||||
return a + 1000;
|
||||
}
|
||||
|
||||
public virtual int Korf
|
||||
{
|
||||
get
|
||||
{
|
||||
return 123;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface IFaceA
|
||||
{
|
||||
int GetA()
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
}
|
||||
|
||||
interface IFaceB
|
||||
{
|
||||
int GetB()
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
}
|
||||
|
||||
interface IFaceC
|
||||
{
|
||||
int GetC()
|
||||
{
|
||||
return 33;
|
||||
}
|
||||
}
|
||||
|
||||
interface IFaceD
|
||||
{
|
||||
int GetD()
|
||||
{
|
||||
return 44;
|
||||
}
|
||||
}
|
||||
|
||||
//#define A
|
||||
|
||||
class ClassB : ClassA
|
||||
/*ClassA_IFaces
|
||||
, IFaceA, IFaceB, IFaceC, IFaceD
|
||||
*/
|
||||
{
|
||||
public override int GetA(int a)
|
||||
{
|
||||
PrintF("Skoof GetA\n");
|
||||
return a + 2000;
|
||||
}
|
||||
|
||||
public override int Korf
|
||||
{
|
||||
get
|
||||
{
|
||||
PrintF("Skoof Korf\n");
|
||||
return 234;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
ClassB cb = scope .();
|
||||
ClassA ca = cb;
|
||||
/*Test_IFaces
|
||||
IFaceA ia = cb;
|
||||
ia.GetA();
|
||||
IFaceB ib = cb;
|
||||
ib.GetB();
|
||||
IFaceC ic = cb;
|
||||
ic.GetC();
|
||||
IFaceD id = cb;
|
||||
id.GetD();
|
||||
*/
|
||||
|
||||
//Test_Start
|
||||
int c = ca.GetA(99);
|
||||
int d = ca.Korf;
|
||||
}
|
||||
}
|
||||
}
|
32
IDE/Tests/Test1/src/bugs/Bug001.bf
Normal file
32
IDE/Tests/Test1/src/bugs/Bug001.bf
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
class Bug001
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
public String mStrA;
|
||||
public String mStrB;
|
||||
public bool mCheck;
|
||||
|
||||
public void DoTest()
|
||||
{
|
||||
int a = 123;
|
||||
int b = 234;
|
||||
if (mCheck)
|
||||
return;
|
||||
|
||||
//Bug001_DoTest
|
||||
while (mCheck)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
ClassA ca = scope .();
|
||||
ca.DoTest();
|
||||
}
|
||||
}
|
23
IDE/Tests/Test1/src/bugs/Bug002.bf
Normal file
23
IDE/Tests/Test1/src/bugs/Bug002.bf
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
class Bug002
|
||||
{
|
||||
public static void Parse(String[] strs)
|
||||
{
|
||||
for (let val in strs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int val2 = 999;
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
var strs = scope String[] {"aaa", "bbb", "ccc"};
|
||||
//Bug002_DoTest
|
||||
Parse(strs);
|
||||
};
|
||||
}
|
2
IDE/Tests/scripts/DebugAndExit.txt
Normal file
2
IDE/Tests/scripts/DebugAndExit.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
StepInto()
|
||||
AssertEvalEquals("args != null", "true")
|
Loading…
Add table
Add a link
Reference in a new issue