Skip to content
Browse files

Move tests to separate project

  • Loading branch information...
1 parent 36f1086 commit 3170492a61056e32ba36a432b40f729654d90fc9 @dharmatech committed Jan 16, 2013
Showing with 306 additions and 188 deletions.
  1. +6 −0 Symbolism.sln
  2. +49 −187 Symbolism/Program.cs
  3. +4 −1 Symbolism/Symbolism.csproj
  4. +148 −0 Tests/Program.cs
  5. +36 −0 Tests/Properties/AssemblyInfo.cs
  6. +63 −0 Tests/Tests.csproj
View
6 Symbolism.sln
@@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Symbolism", "Symbolism\Symbolism.csproj", "{067278C5-2A0F-42DE-838B-855EFB652608}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{9E996759-C2E9-4265-A8CE-16341B26D1CC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@@ -13,6 +15,10 @@ Global
{067278C5-2A0F-42DE-838B-855EFB652608}.Debug|x86.Build.0 = Debug|x86
{067278C5-2A0F-42DE-838B-855EFB652608}.Release|x86.ActiveCfg = Release|x86
{067278C5-2A0F-42DE-838B-855EFB652608}.Release|x86.Build.0 = Release|x86
+ {9E996759-C2E9-4265-A8CE-16341B26D1CC}.Debug|x86.ActiveCfg = Debug|x86
+ {9E996759-C2E9-4265-A8CE-16341B26D1CC}.Debug|x86.Build.0 = Debug|x86
+ {9E996759-C2E9-4265-A8CE-16341B26D1CC}.Release|x86.ActiveCfg = Release|x86
+ {9E996759-C2E9-4265-A8CE-16341B26D1CC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
236 Symbolism/Program.cs
@@ -47,35 +47,35 @@ public abstract class MathObject
#region overloads for 'double'
public static MathObject operator +(MathObject a, double b)
- { return a + new Double(b); }
+ { return a + new DoubleFloat(b); }
public static MathObject operator -(MathObject a, double b)
- { return a - new Double(b); }
+ { return a - new DoubleFloat(b); }
public static MathObject operator *(MathObject a, double b)
- { return a * new Double(b); }
+ { return a * new DoubleFloat(b); }
public static MathObject operator /(MathObject a, double b)
- { return a / new Double(b); }
+ { return a / new DoubleFloat(b); }
public static MathObject operator ^(MathObject a, double b)
- { return a ^ new Double(b); }
+ { return a ^ new DoubleFloat(b); }
public static MathObject operator +(double a, MathObject b)
- { return new Double(a) + b; }
+ { return new DoubleFloat(a) + b; }
public static MathObject operator -(double a, MathObject b)
- { return new Double(a) - b; }
+ { return new DoubleFloat(a) - b; }
public static MathObject operator *(double a, MathObject b)
- { return new Double(a) * b; }
+ { return new DoubleFloat(a) * b; }
public static MathObject operator /(double a, MathObject b)
- { return new Double(a) / b; }
+ { return new DoubleFloat(a) / b; }
public static MathObject operator ^(double a, MathObject b)
- { return new Double(a) ^ b; }
+ { return new DoubleFloat(a) ^ b; }
#endregion
//////////////////////////////////////////////////////////////////////
@@ -152,7 +152,7 @@ public override string ToString()
public Boolean ToBoolean()
{
if (a is Integer && b is Integer) return ((Integer)a).Equals(b);
- if (a is Double && b is Double) return ((Double)a).Equals(b);
+ if (a is DoubleFloat && b is DoubleFloat) return ((DoubleFloat)a).Equals(b);
if (a is Symbol && b is Symbol) return ((Symbol)a).Equals(b);
if (a is Sum && b is Sum) return ((Sum)a).Equals(b);
if (a is Product && b is Product) return ((Product)a).Equals(b);
@@ -196,11 +196,11 @@ public override int GetHashCode()
{ return val.GetHashCode(); }
}
- public class Double : Number
+ public class DoubleFloat : Number
{
public double val;
- public Double(double n) { val = n; }
+ public DoubleFloat(double n) { val = n; }
public string ObjectPrint()
{ return "Double(" + val.ToString("R") + ")"; }
@@ -210,7 +210,7 @@ public override string ToString()
public override bool Equals(object obj)
{
- if (obj is Double) return val == ((Double)obj).val;
+ if (obj is DoubleFloat) return val == ((DoubleFloat)obj).val;
return false;
}
@@ -229,7 +229,7 @@ public Fraction(Integer a, Integer b)
public override string ToString()
{ return "Fraction(" + numerator + ", " + denominator + ")"; }
- public Double ToDouble() { return new Double((double)numerator.val / (double)denominator.val); }
+ public DoubleFloat ToDouble() { return new DoubleFloat((double)numerator.val / (double)denominator.val); }
//////////////////////////////////////////////////////////////////////
public override bool Equals(object obj)
@@ -552,8 +552,8 @@ public class Sin : Function
{
MathObject SinProc(params MathObject[] ls)
{
- if (ls[0] is Double)
- return new Double(Math.Sin(((Double)ls[0]).val));
+ if (ls[0] is DoubleFloat)
+ return new DoubleFloat(Math.Sin(((DoubleFloat)ls[0]).val));
return new Sin(ls[0]);
}
@@ -631,7 +631,7 @@ public static MathObject Const(MathObject u)
if (res.elts[0] is Fraction) return res.elts[0];
- if (res.elts[0] is Double) return res.elts[0];
+ if (res.elts[0] is DoubleFloat) return res.elts[0];
return new Integer(1);
}
@@ -654,17 +654,17 @@ public static bool O3(List<MathObject> uElts, List<MathObject> vElts)
public static bool Compare(MathObject u, MathObject v)
{
- if (u is Double && v is Double) return ((Double)u).val < ((Double)v).val;
+ if (u is DoubleFloat && v is DoubleFloat) return ((DoubleFloat)u).val < ((DoubleFloat)v).val;
- if (u is Double && v is Integer) return ((Double)u).val < ((Integer)v).val;
+ if (u is DoubleFloat && v is Integer) return ((DoubleFloat)u).val < ((Integer)v).val;
- if (u is Double && v is Fraction) return
- ((Double)u).val < ((double)((Fraction)v).numerator.val) / ((double)((Fraction)v).denominator.val);
+ if (u is DoubleFloat && v is Fraction) return
+ ((DoubleFloat)u).val < ((double)((Fraction)v).numerator.val) / ((double)((Fraction)v).denominator.val);
- if (u is Integer && v is Double) return ((Integer)u).val < ((Double)v).val;
+ if (u is Integer && v is DoubleFloat) return ((Integer)u).val < ((DoubleFloat)v).val;
- if (u is Fraction && v is Double) return
- ((double)((Fraction)u).numerator.val) / ((double)((Fraction)u).denominator.val) < ((Double)v).val;
+ if (u is Fraction && v is DoubleFloat) return
+ ((double)((Fraction)u).numerator.val) / ((double)((Fraction)u).denominator.val) < ((DoubleFloat)v).val;
if (u is Integer)
return Compare(new Fraction((Integer)u, new Integer(1)), v);
@@ -739,9 +739,9 @@ public static bool Compare(MathObject u, MathObject v)
String.Compare(u_.name, v_.name) < 0;
}
- if ((u is Integer || u is Fraction || u is Double)
+ if ((u is Integer || u is Fraction || u is DoubleFloat)
&&
- !(v is Integer || v is Fraction || v is Double))
+ !(v is Integer || v is Fraction || v is DoubleFloat))
return true;
if (u is Product &&
@@ -832,17 +832,17 @@ public MathObject Simplify()
if ((v is Integer || v is Fraction) && n is Integer)
return Rational.SimplifyRNE(new Power(v, n));
- if (v is Double && w is Integer)
- return new Double(Math.Pow(((Double)v).val, ((Integer)w).val));
+ if (v is DoubleFloat && w is Integer)
+ return new DoubleFloat(Math.Pow(((DoubleFloat)v).val, ((Integer)w).val));
- if (v is Double && w is Fraction)
- return new Double(Math.Pow(((Double)v).val, ((Fraction)w).ToDouble().val));
+ if (v is DoubleFloat && w is Fraction)
+ return new DoubleFloat(Math.Pow(((DoubleFloat)v).val, ((Fraction)w).ToDouble().val));
- if (v is Integer && w is Double)
- return new Double(Math.Pow(((Integer)v).val, ((Double)w).val));
+ if (v is Integer && w is DoubleFloat)
+ return new DoubleFloat(Math.Pow(((Integer)v).val, ((DoubleFloat)w).val));
- if (v is Fraction && w is Double)
- return new Double(Math.Pow(((Fraction)v).ToDouble().val, ((Double)w).val));
+ if (v is Fraction && w is DoubleFloat)
+ return new DoubleFloat(Math.Pow(((Fraction)v).ToDouble().val, ((DoubleFloat)w).val));
if (v is Power && w is Integer)
{ return ((Power)v).bas ^ (((Power)v).exp * w); }
@@ -941,19 +941,19 @@ static List<MathObject> MergeProducts(List<MathObject> pElts, List<MathObject> q
throw new Exception();
}
- static List<MathObject> SimplifyDoubleNumberProduct(Double a, Number b)
+ static List<MathObject> SimplifyDoubleNumberProduct(DoubleFloat a, Number b)
{
double val = 0.0;
- if (b is Double) val = a.val * ((Double)b).val;
+ if (b is DoubleFloat) val = a.val * ((DoubleFloat)b).val;
if (b is Integer) val = a.val * ((Integer)b).val;
if (b is Fraction) val = a.val * ((Fraction)b).ToDouble().val;
if (val == 1.0) return new List<MathObject>() { };
- return new List<MathObject>() { new Double(val) };
+ return new List<MathObject>() { new DoubleFloat(val) };
}
public static List<MathObject> RecursiveSimplify(List<MathObject> elts)
@@ -977,11 +977,11 @@ public static List<MathObject> RecursiveSimplify(List<MathObject> elts)
//////////////////////////////////////////////////////////////////////
- if (elts[0] is Double && elts[1] is Number)
- return SimplifyDoubleNumberProduct((Double)elts[0], (Number)elts[1]);
+ if (elts[0] is DoubleFloat && elts[1] is Number)
+ return SimplifyDoubleNumberProduct((DoubleFloat)elts[0], (Number)elts[1]);
- if (elts[0] is Number && elts[1] is Double)
- return SimplifyDoubleNumberProduct((Double)elts[1], (Number)elts[0]);
+ if (elts[0] is Number && elts[1] is DoubleFloat)
+ return SimplifyDoubleNumberProduct((DoubleFloat)elts[1], (Number)elts[0]);
//////////////////////////////////////////////////////////////////////
@@ -1101,19 +1101,19 @@ static List<MathObject> MergeSums(List<MathObject> pElts, List<MathObject> qElts
throw new Exception();
}
- static List<MathObject> SimplifyDoubleNumberSum(Double a, Number b)
+ static List<MathObject> SimplifyDoubleNumberSum(DoubleFloat a, Number b)
{
double val = 0.0;
- if (b is Double) val = a.val + ((Double)b).val;
+ if (b is DoubleFloat) val = a.val + ((DoubleFloat)b).val;
if (b is Integer) val = a.val + ((Integer)b).val;
if (b is Fraction) val = a.val + ((Fraction)b).ToDouble().val;
if (val == 0.0) return new List<MathObject>() { };
- return new List<MathObject>() { new Double(val) };
+ return new List<MathObject>() { new DoubleFloat(val) };
}
static List<MathObject> RecursiveSimplify(List<MathObject> elts)
@@ -1137,11 +1137,11 @@ static List<MathObject> RecursiveSimplify(List<MathObject> elts)
//////////////////////////////////////////////////////////////////////
- if (elts[0] is Double && elts[1] is Number)
- return SimplifyDoubleNumberSum((Double)elts[0], (Number)elts[1]);
+ if (elts[0] is DoubleFloat && elts[1] is Number)
+ return SimplifyDoubleNumberSum((DoubleFloat)elts[0], (Number)elts[1]);
- if (elts[0] is Number && elts[1] is Double)
- return SimplifyDoubleNumberSum((Double)elts[1], (Number)elts[0]);
+ if (elts[0] is Number && elts[1] is DoubleFloat)
+ return SimplifyDoubleNumberSum((DoubleFloat)elts[1], (Number)elts[0]);
//////////////////////////////////////////////////////////////////////
@@ -1293,142 +1293,4 @@ public Quotient(params MathObject[] ls)
public MathObject Simplify()
{ return elts[0] * (elts[1] ^ -1); }
}
-
- class Program
- {
- static void Main(string[] args)
- {
- {
- var x = new Symbol("x");
- var y = new Symbol("y");
- var z = new Symbol("z");
-
- Func<int, Integer> Int = (n) => new Integer(n);
-
- Action<Equation> AssertIsTrue = (eq) =>
- {
- if (!eq) Console.WriteLine(eq.ToString());
- };
-
- AssertIsTrue(x + x == 2 * x);
-
- AssertIsTrue(x + x == 2 * x);
-
- AssertIsTrue(x + x + x == 3 * x);
-
- AssertIsTrue(5 + x + 2 == 7 + x);
-
- AssertIsTrue(3 + x + 5 + x == 8 + 2 * x);
-
- AssertIsTrue(4 * x + 3 * x == 7 * x);
-
- AssertIsTrue(x + y + z + x + y + z == 2 * x + 2 * y + 2 * z);
-
- AssertIsTrue(10 - x == 10 + x * -1);
-
- AssertIsTrue(x * y / 3 == Int(1) / 3 * x * y);
-
- AssertIsTrue(x / y == x * (y ^ -1));
-
- AssertIsTrue(x / 3 == x * (Int(1) / 3));
-
- AssertIsTrue(6 * x * y / 3 == 2 * x * y);
-
- AssertIsTrue((((x ^ Int(1) / 2) ^ Int(1) / 2) ^ 8) == (x ^ 2));
-
- AssertIsTrue(((((x * y) ^ (Int(1) / 2)) * (z ^ 2)) ^ 2) == (x * y * (z ^ 4)));
-
- AssertIsTrue(x / x == Int(1));
-
- AssertIsTrue(x / y * y / x == Int(1));
-
- AssertIsTrue((x ^ 2) * (x ^ 3) == (x ^ 5));
-
- AssertIsTrue(x + y + x + z + 5 + z == 5 + 2 * x + y + 2 * z);
-
- AssertIsTrue(((Int(1) / 2) * x + (Int(3) / 4) * x) == Int(5) / 4 * x);
-
- AssertIsTrue(1.2 * x + 3 * x == 4.2 * x);
-
- AssertIsTrue(3 * x + 1.2 * x == 4.2 * x);
-
- AssertIsTrue(1.2 * x * 3 * y == 3.5999999999999996 * x * y);
-
- AssertIsTrue(3 * x * 1.2 * y == 3.5999999999999996 * x * y);
-
- AssertIsTrue(3.4 * x * 1.2 * y == 4.08 * x * y);
-
- // Power.Simplify
-
- AssertIsTrue((0 ^ x) == Int(0));
- AssertIsTrue((1 ^ x) == Int(1));
- AssertIsTrue((x ^ 0) == Int(1));
- AssertIsTrue((x ^ 1) == x);
-
- // Product.Simplify
-
- AssertIsTrue(x * 0 == new Integer(0));
-
- // Difference
-
- AssertIsTrue(-x == -1 * x);
-
- AssertIsTrue(x - y == x + -1 * y);
-
-
- AssertIsTrue(Int(10).Substitute(Int(10), Int(20)) == Int(20));
- AssertIsTrue(Int(10).Substitute(Int(15), Int(20)) == Int(10));
-
- AssertIsTrue(new Double(1.0).Substitute(new Double(1.0), new Double(2.0)) == new Double(2.0));
- AssertIsTrue(new Double(1.0).Substitute(new Double(1.5), new Double(2.0)) == new Double(1.0));
-
- AssertIsTrue((Int(1) / 2).Substitute(Int(1) / 2, Int(3) / 4) == Int(3) / 4);
- AssertIsTrue((Int(1) / 2).Substitute(Int(1) / 3, Int(3) / 4) == Int(1) / 2);
-
- AssertIsTrue(x.Substitute(x, y) == y);
- AssertIsTrue(x.Substitute(y, y) == x);
-
- AssertIsTrue((x ^ y).Substitute(x, Int(10)) == (10 ^ y));
- AssertIsTrue((x ^ y).Substitute(y, Int(10)) == (x ^ 10));
-
- AssertIsTrue((x ^ y).Substitute(x ^ y, Int(10)) == Int(10));
-
- AssertIsTrue((x * y * z).Substitute(x, y) == ((y ^ 2) * z));
- AssertIsTrue((x * y * z).Substitute(x * y * z, x) == x);
-
- AssertIsTrue((x + y + z).Substitute(x, y) == ((y * 2) + z));
- AssertIsTrue((x + y + z).Substitute(x + y + z, x) == x);
-
- AssertIsTrue(
- ((((x * y) ^ (Int(1) / 2)) * (z ^ 2)) ^ 2)
- .Substitute(x, Int(10))
- .Substitute(y, Int(20))
- .Substitute(z, Int(3))
- == Int(16200)
- );
-
- Func<MathObject, MathObject> sin = arg => new Sin(arg).Simplify();
-
- AssertIsTrue(sin(new Double(3.14159 / 2)) == new Double(0.99999999999911982));
-
- AssertIsTrue(sin(x + y) + sin(x + y) == 2 * sin(x + y));
-
- AssertIsTrue(sin(x + x) == sin(2 * x));
-
- AssertIsTrue(sin(x + x).Substitute(x, Int(1)) == sin(Int(2)));
-
- AssertIsTrue(sin(x + x).Substitute(x, new Double(1.0)) == new Double(0.90929742682568171));
-
- AssertIsTrue(sin(2 * x).Substitute(x, y) == sin(2 * y));
-
- // Product.RecursiveSimplify
-
- AssertIsTrue(1 * x == x);
-
- AssertIsTrue(x * 1 == x);
- }
-
- Console.ReadLine();
- }
- }
}
View
5 Symbolism/Symbolism.csproj
@@ -6,7 +6,7 @@
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{067278C5-2A0F-42DE-838B-855EFB652608}</ProjectGuid>
- <OutputType>Exe</OutputType>
+ <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Symbolism</RootNamespace>
<AssemblyName>Symbolism</AssemblyName>
@@ -33,6 +33,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup>
+ <StartupObject />
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
View
148 Tests/Program.cs
@@ -0,0 +1,148 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Symbolism;
+
+namespace Tests
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ {
+ var x = new Symbol("x");
+ var y = new Symbol("y");
+ var z = new Symbol("z");
+
+ Func<int, Integer> Int = (n) => new Integer(n);
+
+ Action<Equation> AssertIsTrue = (eq) =>
+ {
+ if (!eq) Console.WriteLine(eq.ToString());
+ };
+
+ AssertIsTrue(x + x == 2 * x);
+
+ AssertIsTrue(x + x == 2 * x);
+
+ AssertIsTrue(x + x + x == 3 * x);
+
+ AssertIsTrue(5 + x + 2 == 7 + x);
+
+ AssertIsTrue(3 + x + 5 + x == 8 + 2 * x);
+
+ AssertIsTrue(4 * x + 3 * x == 7 * x);
+
+ AssertIsTrue(x + y + z + x + y + z == 2 * x + 2 * y + 2 * z);
+
+ AssertIsTrue(10 - x == 10 + x * -1);
+
+ AssertIsTrue(x * y / 3 == Int(1) / 3 * x * y);
+
+ AssertIsTrue(x / y == x * (y ^ -1));
+
+ AssertIsTrue(x / 3 == x * (Int(1) / 3));
+
+ AssertIsTrue(6 * x * y / 3 == 2 * x * y);
+
+ AssertIsTrue((((x ^ Int(1) / 2) ^ Int(1) / 2) ^ 8) == (x ^ 2));
+
+ AssertIsTrue(((((x * y) ^ (Int(1) / 2)) * (z ^ 2)) ^ 2) == (x * y * (z ^ 4)));
+
+ AssertIsTrue(x / x == Int(1));
+
+ AssertIsTrue(x / y * y / x == Int(1));
+
+ AssertIsTrue((x ^ 2) * (x ^ 3) == (x ^ 5));
+
+ AssertIsTrue(x + y + x + z + 5 + z == 5 + 2 * x + y + 2 * z);
+
+ AssertIsTrue(((Int(1) / 2) * x + (Int(3) / 4) * x) == Int(5) / 4 * x);
+
+ AssertIsTrue(1.2 * x + 3 * x == 4.2 * x);
+
+ AssertIsTrue(3 * x + 1.2 * x == 4.2 * x);
+
+ AssertIsTrue(1.2 * x * 3 * y == 3.5999999999999996 * x * y);
+
+ AssertIsTrue(3 * x * 1.2 * y == 3.5999999999999996 * x * y);
+
+ AssertIsTrue(3.4 * x * 1.2 * y == 4.08 * x * y);
+
+ // Power.Simplify
+
+ AssertIsTrue((0 ^ x) == Int(0));
+ AssertIsTrue((1 ^ x) == Int(1));
+ AssertIsTrue((x ^ 0) == Int(1));
+ AssertIsTrue((x ^ 1) == x);
+
+ // Product.Simplify
+
+ AssertIsTrue(x * 0 == new Integer(0));
+
+ // Difference
+
+ AssertIsTrue(-x == -1 * x);
+
+ AssertIsTrue(x - y == x + -1 * y);
+
+
+ AssertIsTrue(Int(10).Substitute(Int(10), Int(20)) == Int(20));
+ AssertIsTrue(Int(10).Substitute(Int(15), Int(20)) == Int(10));
+
+ AssertIsTrue(new DoubleFloat(1.0).Substitute(new DoubleFloat(1.0), new DoubleFloat(2.0)) == new DoubleFloat(2.0));
+ AssertIsTrue(new DoubleFloat(1.0).Substitute(new DoubleFloat(1.5), new DoubleFloat(2.0)) == new DoubleFloat(1.0));
+
+ AssertIsTrue((Int(1) / 2).Substitute(Int(1) / 2, Int(3) / 4) == Int(3) / 4);
+ AssertIsTrue((Int(1) / 2).Substitute(Int(1) / 3, Int(3) / 4) == Int(1) / 2);
+
+ AssertIsTrue(x.Substitute(x, y) == y);
+ AssertIsTrue(x.Substitute(y, y) == x);
+
+ AssertIsTrue((x ^ y).Substitute(x, Int(10)) == (10 ^ y));
+ AssertIsTrue((x ^ y).Substitute(y, Int(10)) == (x ^ 10));
+
+ AssertIsTrue((x ^ y).Substitute(x ^ y, Int(10)) == Int(10));
+
+ AssertIsTrue((x * y * z).Substitute(x, y) == ((y ^ 2) * z));
+ AssertIsTrue((x * y * z).Substitute(x * y * z, x) == x);
+
+ AssertIsTrue((x + y + z).Substitute(x, y) == ((y * 2) + z));
+ AssertIsTrue((x + y + z).Substitute(x + y + z, x) == x);
+
+ AssertIsTrue(
+ ((((x * y) ^ (Int(1) / 2)) * (z ^ 2)) ^ 2)
+ .Substitute(x, Int(10))
+ .Substitute(y, Int(20))
+ .Substitute(z, Int(3))
+ == Int(16200)
+ );
+
+ Func<MathObject, MathObject> sin = arg => new Sin(arg).Simplify();
+
+ AssertIsTrue(sin(new DoubleFloat(3.14159 / 2)) == new DoubleFloat(0.99999999999911982));
+
+ AssertIsTrue(sin(x + y) + sin(x + y) == 2 * sin(x + y));
+
+ AssertIsTrue(sin(x + x) == sin(2 * x));
+
+ AssertIsTrue(sin(x + x).Substitute(x, Int(1)) == sin(Int(2)));
+
+ AssertIsTrue(sin(x + x).Substitute(x, new DoubleFloat(1.0)) == new DoubleFloat(0.90929742682568171));
+
+ AssertIsTrue(sin(2 * x).Substitute(x, y) == sin(2 * y));
+
+ // Product.RecursiveSimplify
+
+ AssertIsTrue(1 * x == x);
+
+ AssertIsTrue(x * 1 == x);
+ }
+
+ Console.ReadLine();
+
+ }
+ }
+}
View
36 Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tests")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3fa9b461-229b-4e92-a192-35082eaa4fa3")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
63 Tests/Tests.csproj
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9E996759-C2E9-4265-A8CE-16341B26D1CC}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tests</RootNamespace>
+ <AssemblyName>Tests</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Symbolism\Symbolism.csproj">
+ <Project>{067278C5-2A0F-42DE-838B-855EFB652608}</Project>
+ <Name>Symbolism</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>

0 comments on commit 3170492

Please sign in to comment.
Something went wrong with that request. Please try again.