Skip to content

Commit

Permalink
Merge pull request #136 from akkadotnet/dev
Browse files Browse the repository at this point in the history
v0.9.10 Release
  • Loading branch information
Aaronontheweb authored Oct 16, 2019
2 parents b0075b4 + cbcbfdf commit d9a9319
Show file tree
Hide file tree
Showing 22 changed files with 392 additions and 14 deletions.
5 changes: 3 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
### 0.9.9 October 10 2019 ####
Hyperion now supports .NET Core 3.0.
### 0.9.10 October 15 2019 ####

Hyperion now [supports cross-framework communication between .NET Core and .NET Framework](https://github.com/akkadotnet/Hyperion/pull/116).
2 changes: 1 addition & 1 deletion build-system/nightly-builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference

pool:
vmImage: vs2017-win2016
vmImage: windows-2019
demands: Cmd

trigger: none
Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
parameters:
name: 'windows_pr'
displayName: 'Windows PR Validation'
vmImage: 'vs2017-win2016'
vmImage: 'windows-2019'
scriptFileName: build.cmd
scriptArgs: all
- template: azure-pipeline.template.yaml
Expand Down
2 changes: 1 addition & 1 deletion build-system/windows-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
- template: azure-pipeline.template.yaml
parameters:
name: Windows
vmImage: 'vs2017-win2016'
vmImage: 'windows-2019'
scriptFileName: build.cmd
scriptArgs: all
2 changes: 1 addition & 1 deletion build-system/windows-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference

pool:
vmImage: vs2017-win2016
vmImage: windows-2019
demands: Cmd

trigger:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<Compile Include="Types.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.0" />
</ItemGroup>

</Project>
37 changes: 37 additions & 0 deletions src/Hyperion.Tests/CrossFrameworkSerializationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.IO;
using Hyperion.Tests.Generator;
using Xunit;

namespace Hyperion.Tests
{
public class CrossFrameworkSerializationTests
{
private readonly Serializer _serializer;
private readonly CrossFrameworkClass _originalObject;

public CrossFrameworkSerializationTests()
{
_serializer = new Serializer();
_originalObject = CrossFrameworkInitializer.Init();
}

[Fact]
public void CanSerializeCrossFramework()
{
const string defaultOutputPath = CrossFrameworkInitializer.DefaultOutputPath;
var testFiles = Directory.GetFiles(defaultOutputPath, "*.tf");

Assert.NotEmpty(testFiles);

foreach (string testFile in testFiles)
{
using (var fileStream = new FileStream(testFile, FileMode.Open))
{
var crossFrameworkClass = _serializer.Deserialize<CrossFrameworkClass>(fileStream);

Assert.Equal(_originalObject, crossFrameworkClass);
}
}
}
}
}
125 changes: 125 additions & 0 deletions src/Hyperion.Tests/Generator/CrossFrameworkClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using System;

namespace Hyperion.Tests.Generator
{
public class CrossFrameworkClass
{
public sbyte Sbyte { get; set; }

public short Short { get; set; }

public int Int { get; set; }

public long Long { get; set; }

public byte Byte { get; set; }

public ushort UShort { get; set; }

public uint UInt { get; set; }

public ulong ULong { get; set; }

public char Char { get; set; }

public float Float { get; set; }

public double Double { get; set; }

public decimal Decimal { get; set; }

public bool Boolean { get; set; }

public string String { get; set; }

public DateTime DateTime { get; set; }

public Exception Exception { get; set; }

public CrossFrameworkEnum Enum { get; set; }

public CrossFrameworkStruct Struct { get; set; }

public override bool Equals(object obj)
{
if (!(obj is CrossFrameworkClass))
{
return false;
}

var objectToCompare = (CrossFrameworkClass) obj;


//return Sbyte == objectToCompare.Sbyte
// && Short == objectToCompare.Short
// && Int == objectToCompare.Int
// && Long == objectToCompare.Long
// && Byte == objectToCompare.Byte
// && UShort == objectToCompare.UShort
// && UInt == objectToCompare.UInt
// && ULong == objectToCompare.ULong
// && Char == objectToCompare.Char
// && Math.Abs(Float - objectToCompare.Float) < float.Epsilon
// && Math.Abs(Double - objectToCompare.Double) < double.Epsilon
// && Decimal == objectToCompare.Decimal
// && Boolean == objectToCompare.Boolean
// && String == objectToCompare.String
// && DateTime == objectToCompare.DateTime
// && Exception == objectToCompare.Exception
// && Enum == objectToCompare.Enum
// && Struct.Equals(objectToCompare.Struct);

return Equals(objectToCompare);

}

public override int GetHashCode()
{
unchecked
{
int hashCode = Sbyte.GetHashCode();
hashCode = (hashCode * 397) ^ Short.GetHashCode();
hashCode = (hashCode * 397) ^ Int;
hashCode = (hashCode * 397) ^ Long.GetHashCode();
hashCode = (hashCode * 397) ^ Byte.GetHashCode();
hashCode = (hashCode * 397) ^ UShort.GetHashCode();
hashCode = (hashCode * 397) ^ (int) UInt;
hashCode = (hashCode * 397) ^ ULong.GetHashCode();
hashCode = (hashCode * 397) ^ Char.GetHashCode();
hashCode = (hashCode * 397) ^ Float.GetHashCode();
hashCode = (hashCode * 397) ^ Double.GetHashCode();
hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
hashCode = (hashCode * 397) ^ Boolean.GetHashCode();
hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
hashCode = (hashCode * 397) ^ (Exception != null ? Exception.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (int) Enum;
hashCode = (hashCode * 397) ^ Struct.GetHashCode();
return hashCode;
}
}

private bool Equals(CrossFrameworkClass other)
{
return Sbyte == other.Sbyte
&& Short == other.Short
&& Int == other.Int
&& Long == other.Long
&& Byte == other.Byte
&& UShort == other.UShort
&& UInt == other.UInt
&& ULong == other.ULong
&& Char == other.Char
&& Math.Abs(Float - other.Float) < float.Epsilon
&& Math.Abs(Double - other.Double) < double.Epsilon
&& Decimal == other.Decimal
&& Boolean == other.Boolean
&& string.Equals(String, other.String)
&& DateTime.Equals(other.DateTime)
// && Equals(Exception, other.Exception)
&& Exception.Message == other.Exception.Message
&& Enum == other.Enum
&& Struct.Equals(other.Struct);
}
}
}
13 changes: 13 additions & 0 deletions src/Hyperion.Tests/Generator/CrossFrameworkEnum.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Hyperion.Tests.Generator
{
public enum CrossFrameworkEnum
{
ShortSword,
LongSword,
BastardSword,
Claymore,
Scimitar,
Yatagan,
Katana
}
}
49 changes: 49 additions & 0 deletions src/Hyperion.Tests/Generator/CrossFrameworkInitializer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;

namespace Hyperion.Tests.Generator
{
public static class CrossFrameworkInitializer
{
public const string DefaultOutputPath = "../../../testfiles";

public static CrossFrameworkClass Init()
{
return new CrossFrameworkClass()
{
Exception = new Exception("Test message", new ArgumentNullException("param", "Cannot be null")),
DateTime = new DateTime(1944, 6, 6), // DDay
Enum = CrossFrameworkEnum.Yatagan,
String = "On June 6, 1944, more than 160,000 Allied troops landed along a 50-mile stretch of heavily-fortified French coastline",
Struct = new CrossFrameworkStruct()
{
Boolean = true,
Long = long.MaxValue,
Decimal = decimal.MinusOne,
Double = double.MaxValue,
Int = int.MaxValue,
Short = short.MaxValue,
ULong = ulong.MinValue,
Byte = byte.MaxValue,
Char = char.MaxValue,
Float = float.MinValue,
UShort = ushort.MinValue,
UInt = uint.MaxValue,
Sbyte = sbyte.MaxValue
},
Decimal = decimal.MaxValue,
Float = float.MaxValue,
Long = long.MinValue,
Int = int.MinValue,
Double = double.Epsilon,
Char = char.MaxValue,
Byte = byte.MaxValue,
Sbyte = sbyte.MaxValue,
Short = short.MaxValue,
UInt = uint.MaxValue,
ULong = ulong.MaxValue,
UShort = ushort.MaxValue,
Boolean = true
};
}
}
}
83 changes: 83 additions & 0 deletions src/Hyperion.Tests/Generator/CrossFrameworkStruct.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using System;

namespace Hyperion.Tests.Generator
{
public struct CrossFrameworkStruct
{
public sbyte Sbyte { get; set; }

public short Short { get; set; }

public int Int { get; set; }

public long Long { get; set; }

public byte Byte { get; set; }

public ushort UShort { get; set; }

public uint UInt { get; set; }

public ulong ULong { get; set; }

public char Char { get; set; }

public float Float { get; set; }

public double Double { get; set; }

public decimal Decimal { get; set; }

public bool Boolean { get; set; }

public override bool Equals(object obj)
{
if (!(obj is CrossFrameworkStruct))
{
return false;
}

var objectToCompare = (CrossFrameworkStruct)obj;

return Equals(objectToCompare);
}

public override int GetHashCode()
{
unchecked
{
int hashCode = Sbyte.GetHashCode();
hashCode = (hashCode * 397) ^ Short.GetHashCode();
hashCode = (hashCode * 397) ^ Int;
hashCode = (hashCode * 397) ^ Long.GetHashCode();
hashCode = (hashCode * 397) ^ Byte.GetHashCode();
hashCode = (hashCode * 397) ^ UShort.GetHashCode();
hashCode = (hashCode * 397) ^ (int) UInt;
hashCode = (hashCode * 397) ^ ULong.GetHashCode();
hashCode = (hashCode * 397) ^ Char.GetHashCode();
hashCode = (hashCode * 397) ^ Float.GetHashCode();
hashCode = (hashCode * 397) ^ Double.GetHashCode();
hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
hashCode = (hashCode * 397) ^ Boolean.GetHashCode();
return hashCode;
}
}

private bool Equals(CrossFrameworkStruct other)
{
return Sbyte == other.Sbyte
&& Short == other.Short
&& Int == other.Int
&& Long == other.Long
&& Byte == other.Byte
&& UShort == other.UShort
&& UInt == other.UInt
&& ULong == other.ULong
&& Char == other.Char
&& Math.Abs(Float - other.Float) < float.Epsilon
&& Math.Abs(Double - other.Double) < double.Epsilon
&& Decimal == other.Decimal
&& Boolean == other.Boolean;
}
}
}
Loading

0 comments on commit d9a9319

Please sign in to comment.