Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#@ template debug="true" hostspecific="false" language="C#" #>
- <#@ assembly name="System.Core" #>
- <#@ import namespace="System.Linq" #>
- <#@ import namespace="System.Text" #>
- <#@ import namespace="System.Collections.Generic" #>
- <#@ output extension=".cs" #>
- <#
- Dictionary<string, TypeInfo> types = new Dictionary<string, TypeInfo>()
- {
- { "Decimal", new TypeInfo() { Type = typeof(decimal), TypeName = "Decimal", Name = "Decimal", Signed = true, Decimal = true, MateName = null, BitCount = 128, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "Double", new TypeInfo() { Type = typeof(double), TypeName = "Double", Name = "Double", Signed = true, Decimal = true, MateName = null, BitCount = 64, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "Float", new TypeInfo() { Type = typeof(Single), TypeName = "Single", Name = "Float", Signed = true, Decimal = true, MateName = null, BitCount = 32, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "Byte", new TypeInfo() { Type = typeof(byte), TypeName = "Byte", Name = "Byte", Signed = false, Decimal = false, MateName = "SByte", BitCount = 8, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "SByte", new TypeInfo() { Type = typeof(sbyte), TypeName = "SByte", Name = "SByte", Signed = true, Decimal = false, MateName = "Byte", BitCount = 8, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "Short", new TypeInfo() { Type = typeof(Int16), TypeName = "Int16", Name = "Short", Signed = true, Decimal = false, MateName = "UShort", BitCount = 16, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "UShort", new TypeInfo() { Type = typeof(UInt16), TypeName = "UInt16", Name = "UShort", Signed = false, Decimal = false, MateName = "Short", BitCount = 16, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "Int", new TypeInfo() { Type = typeof(Int32), TypeName = "Int32", Name = "Int", Signed = true, Decimal = false, MateName = "UInt", BitCount = 32, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "UInt", new TypeInfo() { Type = typeof(UInt32), TypeName = "UInt32", Name = "UInt", Signed = false, Decimal = false, MateName = "Int", BitCount = 32, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "Long", new TypeInfo() { Type = typeof(Int64), TypeName = "Int64", Name = "Long", Signed = true, Decimal = false, MateName = "ULong", BitCount = 64, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } },
- { "ULong", new TypeInfo() { Type = typeof(UInt64), TypeName = "UInt64", Name = "ULong", Signed = false, Decimal = false, MateName = "Long", BitCount = 64, ConvertTo = new Dictionary<string, string>(), ConvertFrom = new Dictionary<string, string>() } }
- };
- #>
- using System;
- //using XGEFCore;
- using test;
- //using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Stats;
- //****************************
- //****************************
- //
- // THE BELOW CODE IS AUTOGENERATED. Please do not bother editing it, instead please see the template that it was generated from.
- //
- //****************************
- //****************************
- namespace StatTests
- {
- public class Assert
- {
- public static void IsTrue(params object[] values) { }
- }
- <# foreach(var pair in types) {
- string T = pair.Value.Type.Name;
- string Class = pair.Key + "Stat"; #>
- //[TestClass()]
- public class <#= Class #>Tests
- {
- #region Operator Overload Tests
- <# foreach(var typePair in types) {
- string otherT = typePair.Value.Type.Name;
- string otherClass = typePair.Value.Name + "Stat";#>
- //[TestMethod()]
- public void <#= Class #>_Add<#= otherT #>()
- {
- <#= Class #> stat = 0;
- <#= otherT #> rhs = 50;
- stat += rhs;
- Assert.IsTrue(stat.Value == 50);
- }
- //[TestMethod()]
- public void <#= Class #>_Add<#= otherClass #>()
- {
- <#= Class #> stat = 0;
- <#= otherClass #> rhs = 50;
- stat += rhs;
- Assert.IsTrue(stat.Value == 50);
- }
- //[TestMethod()]
- public void <#= Class #>_Subtract<#= otherT #>()
- {
- <#= Class #> stat = 100;
- <#= otherT #> rhs = 50;
- stat -= rhs;
- Assert.IsTrue(stat.Value == 50);
- }
- //[TestMethod()]
- public void <#= Class #>_Subtract<#= otherClass #>()
- {
- <#= Class #> stat = 100;
- <#= otherClass #> rhs = 50;
- stat += rhs;
- Assert.IsTrue(stat.Value == 50);
- }
- //[TestMethod()]
- public void <#= Class #>_Multiply<#= otherT #>()
- {
- <#= Class #> stat = 10;
- <#= otherT #> rhs = 5;
- stat *= rhs;
- Assert.IsTrue(stat.Value == 50);
- }
- //[TestMethod()]
- public void <#= Class #>_Multiply<#= otherClass #>()
- {
- <#= Class #> stat = 10;
- <#= otherClass #> rhs = 5;
- stat *= rhs;
- Assert.IsTrue(stat.Value == 50);
- }
- //[TestMethod()]
- public void <#= Class #>_Divide<#= otherT #>()
- {
- <#= Class #> stat = 50;
- <#= otherT #> rhs = 10;
- stat /= rhs;
- Assert.IsTrue(stat.Value == 5);
- }
- //[TestMethod()]
- public void <#= Class #>_Divide<#= otherClass #>()
- {
- <#= Class #> stat = 50;
- <#= otherClass #> rhs = 10;
- stat /= rhs;
- Assert.IsTrue(stat.Value == 5);
- }
- //[TestMethod()]
- public void <#= Class #>_Modulo<#= otherT #>()
- {
- <#= Class #> stat = 50;
- <#= otherT #> rhs = 10;
- stat %= rhs;
- Assert.IsTrue(stat.Value == 0);
- }
- //[TestMethod()]
- public void <#= Class #>_Modulo<#= otherClass #>()
- {
- <#= Class #> stat = 50;
- <#= otherClass #> rhs = 10;
- stat %= rhs;
- Assert.IsTrue(stat.Value == 0);
- }
- //[TestMethod()]
- public void <#= Class #>_Pow<#= otherT #>()
- {
- <#= Class #> stat = 10;
- <#= otherT #> rhs = 2;
- stat ^= rhs;
- Assert.IsTrue(stat.Value == 100);
- }
- //[TestMethod()]
- public void <#= Class #>_Pow<#= otherClass #>()
- {
- <#= Class #> stat = 10;
- <#= otherClass #> rhs = 2;
- stat ^= rhs;
- Assert.IsTrue(stat.Value == 100);
- }
- //[TestMethod()]
- public void <#= Class #>_GreaterThan<#= otherT #>()
- {
- <#= Class #> stat = 10;
- <#= otherT #> rhs = 2;
- Assert.IsTrue(stat > rhs);
- }
- //[TestMethod()]
- public void <#= Class #>_GreaterThan<#= otherClass #>()
- {
- <#= Class #> stat = 10;
- <#= otherClass #> rhs = 2;
- Assert.IsTrue(stat > rhs);
- }
- //[TestMethod()]
- public void <#= Class #>_LessThan<#= otherT #>()
- {
- <#= Class #> stat = 10;
- <#= otherT #> rhs = 100;
- Assert.IsTrue(stat < rhs);
- }
- //[TestMethod()]
- public void <#= Class #>_LessThan<#= otherClass #>()
- {
- <#= Class #> stat = 10;
- <#= otherClass #> rhs = 100;
- Assert.IsTrue(stat < rhs);
- }
- <# } #>
- }
- #endregion
- <# } #>
- }
- <#+
- public struct TypeInfo
- {
- public Type Type { get; set; }
- public string Name { get; set; }
- public string TypeName { get; set; }
- public bool Signed { get; set; }
- public bool Decimal { get; set; }
- public string MateName { get; set; }
- public int BitCount { get; set; }
- public Dictionary<string, string> ConvertTo { get; set; }
- public Dictionary<string, string> ConvertFrom{ get; set; }
- }
- #>
Advertisement
Add Comment
Please, Sign In to add comment