mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 04:52:21 +02:00
New tests
This commit is contained in:
parent
a4476332fe
commit
cbae124dd5
4 changed files with 94 additions and 5 deletions
|
@ -56,7 +56,7 @@ struct StructB
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct [[nodiscard]] StructA
|
struct StructA
|
||||||
{
|
{
|
||||||
StructB* mSB;
|
StructB* mSB;
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ struct [[nodiscard]] StructA
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
int GetVal()
|
int GetVal()
|
||||||
{
|
{
|
||||||
return 9;
|
return 9;
|
||||||
|
@ -83,20 +82,78 @@ StructA GetSA()
|
||||||
return StructA();
|
return StructA();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Zorq()
|
||||||
|
{
|
||||||
|
int zaf = 123;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Base
|
||||||
|
{
|
||||||
|
int32_t mA;
|
||||||
|
int64_t mB;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Derived : Base
|
||||||
|
{
|
||||||
|
int8_t mC;
|
||||||
|
|
||||||
|
int GetC()
|
||||||
|
{
|
||||||
|
return mC + 10000;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Int
|
||||||
|
{
|
||||||
|
int64_t mVal;
|
||||||
|
};
|
||||||
|
|
||||||
|
void Zorq2()
|
||||||
|
{
|
||||||
|
Derived dr;
|
||||||
|
dr.mA = 1;
|
||||||
|
dr.mB = 2;
|
||||||
|
dr.mC = 3;
|
||||||
|
dr.GetC();
|
||||||
|
Int iVal;
|
||||||
|
iVal.mVal = 88;
|
||||||
|
|
||||||
|
int64_t q = 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Zorq3()
|
||||||
|
{
|
||||||
|
Derived dr;
|
||||||
|
dr.mA = 1;
|
||||||
|
dr.mB = 2;
|
||||||
|
dr.mC = 3;
|
||||||
|
Int iVal;
|
||||||
|
iVal.mVal = 88;
|
||||||
|
|
||||||
|
int64_t q = 999;
|
||||||
|
}
|
||||||
|
|
||||||
// THIS IS VERSION 6.
|
// THIS IS VERSION 6.
|
||||||
extern "C"
|
extern "C"
|
||||||
__declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
|
__declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
|
||||||
{
|
{
|
||||||
|
Zorq();
|
||||||
|
Zorq2();
|
||||||
|
Zorq3();
|
||||||
|
|
||||||
GetVal();
|
GetVal();
|
||||||
GetSA();
|
GetSA();
|
||||||
|
|
||||||
//Sleep(10000);
|
//Sleep(10000);
|
||||||
|
|
||||||
|
int zed = 999;
|
||||||
|
|
||||||
StructA sa;
|
StructA sa;
|
||||||
sa.mSB = NULL;
|
sa.mSB = NULL;
|
||||||
Sleep(200);
|
Sleep(200);
|
||||||
sa.GetVal();
|
//sa.GetVal();
|
||||||
sa.GetWithSleep();
|
//sa.GetWithSleep();
|
||||||
//auto val = sa.mSB->mStr;
|
//auto val = sa.mSB->mStr;
|
||||||
|
|
||||||
std::string str = "Hey Dude";
|
std::string str = "Hey Dude";
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace IDETest
|
||||||
Derived dr = .();
|
Derived dr = .();
|
||||||
Int iVal = (.)123;
|
Int iVal = (.)123;
|
||||||
|
|
||||||
|
int q = 999;
|
||||||
|
|
||||||
//Test_End
|
//Test_End
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,17 @@ class LibClassA
|
||||||
{
|
{
|
||||||
return 9;
|
return 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetVal3(Object obj)
|
||||||
|
{
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LibClassB
|
class LibClassB
|
||||||
{
|
{
|
||||||
//public uint8* mA = append uint8[10];
|
public static int DoGetVal3<T>(T val)
|
||||||
|
{
|
||||||
|
return LibClassA.GetVal3(val);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
#pragma warning disable 168
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace System.Collections.Generic
|
namespace System.Collections.Generic
|
||||||
|
@ -24,6 +26,14 @@ namespace System.Collections.Generic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension LibClassA
|
||||||
|
{
|
||||||
|
public static int GetVal3<T>(T val)
|
||||||
|
{
|
||||||
|
return 31;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
{
|
{
|
||||||
class Extensions
|
class Extensions
|
||||||
|
@ -170,5 +180,17 @@ namespace Tests
|
||||||
Test.Assert(ca.LibB_GetB() == 8);
|
Test.Assert(ca.LibB_GetB() == 8);
|
||||||
Test.Assert(ca.LibC_GetB() == 30013);
|
Test.Assert(ca.LibC_GetB() == 30013);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public static void TestExtensionOverride()
|
||||||
|
{
|
||||||
|
int a = 123;
|
||||||
|
int directResult = LibClassA.GetVal3(a);
|
||||||
|
Test.Assert(directResult == 31);
|
||||||
|
// This should only call the LibA version since the LibA:LibClassB.DoGetVal3 won't have
|
||||||
|
// access to call the Tests:LibClassB.DoGetVal3
|
||||||
|
int indirectResult = LibClassB.DoGetVal3(a);
|
||||||
|
Test.Assert(directResult == 30);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue