Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Organize tests

  • Loading branch information...
commit b8d4457ba4a8b19b64ca0b1de27a8754caf987d6 1 parent 9b7de06
dharmatech authored

Showing 1 changed file with 16 additions and 108 deletions. Show diff stats Hide diff stats

  1. 124  Symbolism/Program.cs
124  Symbolism/Program.cs
@@ -1369,6 +1369,13 @@ static void Main(string[] args)
1369 1369
 
1370 1370
                 AssertIsTrue(3.4 * x * 1.2 * y == 4.08 * x * y);
1371 1371
 
  1372
+                // Power.Simplify
  1373
+
  1374
+                AssertIsTrue((0 ^ x) == Int(0));
  1375
+                AssertIsTrue((1 ^ x) == Int(1));
  1376
+                AssertIsTrue((x ^ 0) == Int(1));
  1377
+                AssertIsTrue((x ^ 1) == x);
  1378
+
1372 1379
                 // Product.Simplify
1373 1380
 
1374 1381
                 AssertIsTrue(x * 0 == new Integer(0));
@@ -1379,50 +1386,7 @@ static void Main(string[] args)
1379 1386
 
1380 1387
                 AssertIsTrue(x - y == x + -1 * y);
1381 1388
 
1382  
-                // Console.WriteLine((x == Int(4)).ToString());
1383  
-
1384  
-                // Console.WriteLine((Equation)(x == Int(4)));
1385  
-
1386  
-                // Console.WriteLine(new Equation() { a = x, b = y });
1387  
-
1388  
-                // Console.WriteLine((Boolean)new Equation() { a = x, b = y });
1389  
-
1390  
-                // var val = (Boolean)new Equation() { a = x, b = y };
1391  
-
1392  
-                //if (new Equation() { a = x, b = x })
1393  
-                //    Console.WriteLine("Equation to bool");
1394  
-
1395  
-                //Console.WriteLine((Int(2) == Int(3)).ToString());
1396  
-
1397  
-                //Console.WriteLine(Int(1) != Int(2));
1398  
-
1399  
-                //Console.WriteLine((x == y * 5).ToString());
1400  
-
1401  
-                //Console.WriteLine((x == y).ToString());
1402  
-
1403  
-                //Console.WriteLine("expr");
1404  
-                //Console.WriteLine(x == x);
1405  
-                //Console.WriteLine(x == y);
1406  
-
1407  
-                //{
1408  
-                //    var a = new Double(1.0);
1409  
-                //    var b = new Double(1.0);
1410  
-                //    var c = a;
1411  
-
1412  
-                //    Console.WriteLine(a.Equals(a));
1413  
-                //    Console.WriteLine(a.Equals(b));
1414  
-                //    Console.WriteLine(a.Equals(c));
1415  
-
1416  
-                //    Decimal d = 1.10M;
1417  
-                //    Decimal e = 1.100M;
1418  
-
1419  
-                //    Console.WriteLine(d);
1420  
-                //    Console.WriteLine(e);
1421  
-
1422  
-                //    Console.WriteLine(d == e);
1423  
-
1424  
-                //}
1425  
-
  1389
+                
1426 1390
                 AssertIsTrue(Int(10).Substitute(Int(10), Int(20)) == Int(20));
1427 1391
                 AssertIsTrue(Int(10).Substitute(Int(15), Int(20)) == Int(10));
1428 1392
 
@@ -1446,83 +1410,27 @@ static void Main(string[] args)
1446 1410
                 AssertIsTrue((x + y + z).Substitute(x, y) == ((y * 2) + z));
1447 1411
                 AssertIsTrue((x + y + z).Substitute(x + y + z, x) == x);
1448 1412
 
1449  
-                AssertIsTrue((0 ^ x) == Int(0));
1450  
-                AssertIsTrue((1 ^ x) == Int(1));
1451  
-                AssertIsTrue((x ^ 0) == Int(1));
1452  
-                AssertIsTrue((x ^ 1) == x);
1453  
-
1454  
-                //Console.WriteLine((10 * x * (z + 2) == y).ToString());
1455  
-
1456  
-                //Console.WriteLine((x + y * 2 * (z + 4) + (x ^ 2) == z).ToString());
1457  
-
1458  
-                //Console.WriteLine((x + y * 2 * (z + 4) + (x ^ 2) + (x * 3 ^ (2 + z)) == z).ToString());
1459  
-
1460  
-                Console.WriteLine();
1461  
-
1462  
-                Console.WriteLine(((((x * y) ^ (Int(1) / 2)) * (z ^ 2)) ^ 2).ToString());
1463  
-
1464  
-                Console.WriteLine(
  1413
+                AssertIsTrue(
1465 1414
                     ((((x * y) ^ (Int(1) / 2)) * (z ^ 2)) ^ 2)
1466 1415
                         .Substitute(x, Int(10))
1467 1416
                         .Substitute(y, Int(20))
1468 1417
                         .Substitute(z, Int(3))
  1418
+                        == Int(16200)
1469 1419
                         );
1470 1420
 
1471  
-
1472  
-                //{
1473  
-                //    var tbl = new Dictionary<Object, int>();
1474  
-
1475  
-                //    tbl.Add(new Integer(1), 100);
1476  
-
1477  
-                //    tbl.Add(1, 200);
1478  
-
1479  
-                //    Console.WriteLine(tbl[new Integer(1)]);
1480  
-                //    Console.WriteLine(tbl[1]);
1481  
-                //}
1482  
-
1483 1421
                 Func<MathObject, MathObject> sin = arg => new Sin(arg).Simplify();
1484 1422
 
1485  
-                Console.WriteLine(sin(x));
1486  
-
1487  
-                Console.WriteLine(sin(new Double(3.14159 / 2)));
  1423
+                AssertIsTrue(sin(new Double(3.14159 / 2)) == new Double(0.99999999999911982));
1488 1424
 
1489  
-                Console.WriteLine(sin(x + y) + sin(x + y));
  1425
+                AssertIsTrue(sin(x + y) + sin(x + y) == 2 * sin(x + y));
1490 1426
 
1491  
-                Console.WriteLine(sin(x + x));
  1427
+                AssertIsTrue(sin(x + x) == sin(2 * x));
1492 1428
 
1493  
-                Console.WriteLine(sin(x + x).Substitute(x, Int(1)));
1494  
-
1495  
-                Console.WriteLine(sin(x + x).Substitute(x, new Double(1.0)));
1496  
-
1497  
-                {
1498  
-                    var a = sin(2 * x);
  1429
+                AssertIsTrue(sin(x + x).Substitute(x, Int(1)) == sin(Int(2)));
1499 1430
 
1500  
-                    var b = a.Substitute(x, y);
  1431
+                AssertIsTrue(sin(x + x).Substitute(x, new Double(1.0)) == new Double(0.90929742682568171));
1501 1432
 
1502  
-                    Console.WriteLine(a);
1503  
-                    Console.WriteLine(b);
1504  
-                }
1505  
-
1506  
-                {
1507  
-                    var a = new List<MathObject>() { x, y, z };
1508  
-                    var b = new List<MathObject>() { x, y, z };
1509  
-
1510  
-                    Console.WriteLine(a == b);
1511  
-
1512  
-                    Console.WriteLine(a.SequenceEqual(b));
1513  
-
1514  
-                }
1515  
-
1516  
-                {
1517  
-                    var a = x * y;
1518  
-                    var b = x + y;
1519  
-
1520  
-                    Console.WriteLine(a == b);
1521  
-
1522  
-                    // Console.WriteLine(((Product)a).Equals(b));
1523  
-
1524  
-                    // Console.WriteLine(new Integer(10) == 10);
1525  
-                }
  1433
+                AssertIsTrue(sin(2 * x).Substitute(x, y) == sin(2 * y));
1526 1434
             }
1527 1435
 
1528 1436
             Console.ReadLine();

0 notes on commit b8d4457

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