- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/Tests/UnitTestFrictionModel.cs

    00001 ﻿using System;
    00002 using System.Text;
    00003 using System.Collections.Generic;
    00004 using System.Linq;
    00005 using Microsoft.VisualStudio.TestTools.UnitTesting;
    00006 using NewGamePhysics.Physics;
    00007
    00008 namespace Tests
    00009 {
    00013     [TestClass]
    00014     public class UnitTestFrictionModel
    00015     {
    00016         public UnitTestFrictionModel()
    00017         {
    00018             //
    00019             // TODO: Add constructor logic here
    00020             //
    00021         }
    00022
    00023         private TestContext testContextInstance;
    00024
    00029         public TestContext TestContext
    00030         {
    00031             get
    00032             {
    00033                 return testContextInstance;
    00034             }
    00035             set
    00036             {
    00037                 testContextInstance = value;
    00038             }
    00039         }
    00040
    00041         #region Additional test attributes
    00042         //
    00043         // You can use the following additional attributes as you write your tests:
    00044         //
    00045         // Use ClassInitialize to run code before running the first test in the class
    00046         // [ClassInitialize()]
    00047         // public static void MyClassInitialize(TestContext testContext) { }
    00048         //
    00049         // Use ClassCleanup to run code after all tests in a class have run
    00050         // [ClassCleanup()]
    00051         // public static void MyClassCleanup() { }
    00052         //
    00053         // Use TestInitialize to run code before running each test
    00054         // [TestInitialize()]
    00055         // public void MyTestInitialize() { }
    00056         //
    00057         // Use TestCleanup to run code after each test has run
    00058         // [TestCleanup()]
    00059         // public void MyTestCleanup() { }
    00060         //
    00061         #endregion
    00062
    00063         [TestMethod]
    00064         public void TestFrictionTypeStribeck()
    00065         {
    00066             RotationalFrictionModel model = new RotationalFrictionModel(RotationalFrictionType.Stribeck);
    00067             int steps = 100;
    00068             double omegaMin = -1.0;
    00069             double omegaMax =  1.0;
    00070             double omegaStep = (omegaMax - omegaMin) / steps;
    00071             for (int i = 0; i <= steps; i++)
    00072             {
    00073                 double omega = omegaMin + omegaStep * i;
    00074                 double deltaOmega = model.ApplyFriction(omega) - omega;
    00075                 System.Console.WriteLine("{0} {1}", omega, deltaOmega);
    00076                 omega += omegaStep;
    00077             }
    00078         }
    00079     }
    00080 }