Source code for MSQuant: PILmassCalcTests.cs, MSQlib1/src/massspec/PILmassCalcTests.cs.

Table of contents page.

Home page for MSQuant.

/****************************************************************************
 * Copyright (C) 2008 Peter Mortensen and Matthias Mann                     *
 * This file is part of MSQuant.                                            *
 *                                                                          *
 * MSQuant is distributed under the terms of                                *
 * the GNU General Public License. See src/COPYING.TXT or                   *
 * <http://www.gnu.org/licenses/gpl.txt> for details.                       *
 *                                                                          *
 * MSQuant is free software; you can redistribute it                        *
 * and/or modify it under the terms of the GNU                              *
 * General Public License as published by the Free                          *
 * Software Foundation; either version 2 of the                             *
 * License, or (at your option) any later version.                          *
 *                                                                          *
 * MSQuant is distributed in the hope that it will be                       *
 * useful, but WITHOUT ANY WARRANTY; without even the                       *
 * implied warranty of MERCHANTABILITY or FITNESS FOR                       *
 * A PARTICULAR PURPOSE.  See the GNU General Public                        *
 * License for more details.                                                *
 *                                                                          *
 * You should have received a copy of the GNU General                       *
 * Public License along with MSQuant; if not, write to                      *
 * the Free Software Foundation, Inc., 59 Temple                            *
 * Place, Suite 330, Boston, MA  02111-1307  USA                            *
 *                                                                          *
 * Purpose: Unit testing of class PILmassCalc.                              *
 *                                                                          *
 ****************************************************************************/

/****************************************************************************
 *                               CEBI                                       *
 *                    Software Development Group                            *
 *                         Peter Mortensen                                  *
 *                E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk          *
 *                 WWW: http://www.cebi.sdu.dk/                             *
 *                                                                          *
 *  Program for post-processing of result from search in mass               *
 *    spectrometric data.                                                   *
 *                                                                          *
 *    FILENAME:   PILmassCalcTests.cs                                       *
 *    TYPE:       CSHARP                                                    *
 *                                                                          *
 * CREATED: PM 2008-02-28   Vrs 1.0.                                        *
 * UPDATED: PM 2008-xx-xx                                                   *
 *                                                                          *
 *                                                                          *
 *                                                                          *
 ****************************************************************************/

//using System;
//using System.Collections.Generic;
//using System.Text;

using NUnit.Framework;


using massSpectrometryBase; //For PILmassCalc.


//What namespace to use?
/****************************************************************************
 *    <placeholder for header>                                              *
 ****************************************************************************/
namespace namespaceForPILmassCalcTests
{

    /****************************************************************************
     *    <placeholder for header>                                              *
     ****************************************************************************/
    [TestFixture]
    public class PILmassCalcTests
    {
        /****************************************************************************
         *    <placeholder for header>                                              *
         ****************************************************************************/
        [Test]
        public void chargeTransforms2()
        {
            double tol = 1.0E-6;

            {
                //Fix later: failure on an insignificant level, 2e-5 (because
                //we changed the proton mass slightly?):
                //  "namespaceForPILmassCalcTests.PILmassCalcTests.chargeTransforms2 :
                //   Expected: 1625.7720575450001d +/-
                //   9.9999999999999995E-07d But was:
                //             1625.77207178d

                double neu1 = PILmassCalc.chargeTransform(1626.779334, 1, 0);

                //Changed PM_UNITTEST_PASS 2008-07-24
                //Now uses expected value computed by spreadsheets.
                //Assert.AreEqual(neu1, 1625.77207178, tol, "");
                Assert.AreEqual(neu1, 1625.77205755, tol, "");
            }

            {
                double charged3 = PILmassCalc.chargeTransform(1626.779334, 1, 3);

                //Changed PM_UNITTEST_PASS 2008-07-24
                //Now uses expected value computed by spreadsheets.
                //Assert.AreEqual(charged3, 542.93128663, tol, "");
                Assert.AreEqual(charged3, 542.93129564, tol, "");
            }

            {
                double charged1 = PILmassCalc.chargeTransform(542.93128663, 3, 1);

                //Changed PM_UNITTEST_PASS 2008-07-24
                //Now uses expected value computed by spreadsheets.
                //Assert.AreEqual(charged1, 1626.779334, tol, "");
                Assert.AreEqual(charged1, 1626.77930698, tol, "");
            }

            {
                double charged3b = PILmassCalc.chargeTransform(1625.77207178, 0, 3);


                //Changed PM_UNITTEST_PASS 2008-07-24
                //Now uses expected value computed by spreadsheets.
                //Assert.AreEqual(charged3b, 542.93128663, tol, "");
                Assert.AreEqual(charged3b, 542.931300382, tol, "");
            }

        } //chargeTransforms2

    } //class PILmassCalcTests

} //namespace namespaceForPILmassCalcTests


    

    

Generated by script codePublish.pl at 2009-01-05T15:20:59.