From 9c2f95e1cd6e2671c4aa8d5aabf732c2bbd61ca0 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 31 Jan 2020 16:09:35 -0800 Subject: [PATCH] New tests --- IDEHelper/Tests/src/Boxing.bf | 9 +++++++++ IDEHelper/Tests/src/Ints.bf | 11 +++++++++++ IDEHelper/Tests/src/Operators.bf | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/IDEHelper/Tests/src/Boxing.bf b/IDEHelper/Tests/src/Boxing.bf index 6dffbf20..7e3dbc6e 100644 --- a/IDEHelper/Tests/src/Boxing.bf +++ b/IDEHelper/Tests/src/Boxing.bf @@ -1,3 +1,5 @@ +#pragma warning disable 168 + using System; namespace Tests @@ -57,6 +59,13 @@ namespace Tests Test.Assert(iface1.Get() == 1100); Test.Assert(GetFromIFace(iface1) == 2100); Test.Assert(valB.mA == 1100); // This should copy values + + var boxedVal = scope box valA; + iface0 = boxedVal; + +#unwarn + var boxedStr = scope box "Test"; + IHashable ihash = boxedStr; } [Test] diff --git a/IDEHelper/Tests/src/Ints.bf b/IDEHelper/Tests/src/Ints.bf index 6835e8ec..f9d35fcd 100644 --- a/IDEHelper/Tests/src/Ints.bf +++ b/IDEHelper/Tests/src/Ints.bf @@ -1,9 +1,20 @@ +#pragma warning disable 168 + using System; namespace Tests { class Ints { + [Test] + public static void TestBasics() + { + int i; + decltype(i + 100) j = 123; + Test.Assert(typeof(decltype(j)) == typeof(int)); + int k = j + 10; + } + [Test] public static void TestUInt64() { diff --git a/IDEHelper/Tests/src/Operators.bf b/IDEHelper/Tests/src/Operators.bf index 1581fcf6..bb4ffb8e 100644 --- a/IDEHelper/Tests/src/Operators.bf +++ b/IDEHelper/Tests/src/Operators.bf @@ -215,5 +215,30 @@ namespace Tests let oai2 = OuterOp2.InnerOp.Op(2.0f, 200); Test.Assert(oai2 == 202.0f);*/ } + + struct IntStruct + { + public int mA = 123; + + public typealias ZaffInt = int; + + public ZaffInt GetIt() + { + return 123; + } + + public static implicit operator int(Self val) + { + return val.mA; + } + } + + [Test] + public static void TestCompareWithCastOperator() + { + IntStruct iVal = .(); + Test.Assert(iVal == 123); + Test.Assert(iVal == 123.0f); + } } }